Attributes are one of the two main building blocks of XML. Attributes are name-value pairs associated with an element. Attributes are part of XML elements. An element can have multiple unique attributes. Attribute gives more information about XML elements, they define properties of elements.
Syntax
....content..
....content..
.....
....
.....
....
.....
....
female
In the first example, gender is an attribute. In the second example, gender is an element. Both examples provide the same information. There are no rules about when to use attributes or when to use elements in XML.
Avoid XML Attributes because they cannot contain multiple values, they cannot contain tree structures and they are not easily expandable