Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing XML

XML Attributes:



XML attributes with an example:

Consider an XML document representing information about a product:

        
<product id="12345" category="Electronics" brand="Samsung"> <name>Smartphone</name> <price currency="USD">500</price> </product>

In this XML document, the <product> element has three attributes:

  1. id Attribute:

    • The id attribute has a value of "12345", which serves as a unique identifier for the product.
  2. category Attribute:

    • The category attribute has a value of "Electronics", indicating the category to which the product belongs.
  3. brand Attribute:

    • The brand attribute has a value of "Samsung", specifying the brand of the product.

Attributes provide additional information about elements in XML. Here's a breakdown of attributes in XML:

In the provided example, the attributes id, category, and brand provide additional information about the product element, enhancing its semantics and allowing for more detailed description of the product.





Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java