In this article we are going to look at the semantics of XML attributes.
They can be conveyed as 3 Us: Unique, Unordered, Unstructured.
Let’s look at each semantic in detail.
There can be only one attribute with a given name in an XML element.
For example this is correct:
<a href="#1">link</a>
while this is not:
<a href="#1" href="#2">link</a>
The order in which attributes appear in an element does not matter.
For example these elements are equivalent:
<a href="#" id="link1">link</a>
<a id="link1" href="#">link</a>
The value of an attribute can only be text. It cannot contain nested XML elements or attributes.
For example even though the value of the id
attribute in the following element contains XML syntax, it will not be parsed as such:
<a href="#" id="<source>1</source><value>link1</value>">link</a>
similarly there is no notion of nested attributes in XML:
<a href="#" id="source='1' value='link1'">link</a>
© 2022 Darius J Chuck