/    /  XML – Attributes

XML – Attributes

XML attributes are parameters with key-value pair syntax in an element. An element can have multiple attributes. If you have basic understanding about HTML you might have experienced the attributes like id=”class=” . In the same way the XML will have attributes in an element.

Syntax:

<Element att1  att2> 
Data..
</Element> 

Attribute looks like a key value pair as below:

category="Gold"

Example:

<customer_list> 
	<customer category="Gold"> 
		<name>Sanjay</name> 
		<location>Mumbai</location> 
	</customer> 
	<customer category="Silver"> 
		<name>Micheal</name> 
		<location>Washington</location> 
	</customer> 
</customer_list>