XML attributes are normally used to describe XML elements, or to
provide additional information about elements. From HTML you can
remember this construct: <IMG SRC="mycomputer.gif">. In this HTML
example SRC is an attribute to the IMG element. The SRC attribute
provides additional information about the element.
Attributes are always contained within the start tag of an
element. Here are some examples:
HTML examples:
<img src="mycomputer.gif">
<a href="demo.asp">
XML examples:
<file type="gif">
<person id="3344">
|
Usually, or most common, attributes are used to provide
information that is not a part of the content of the XML document.
Did you understand that? Here is another way to express that: Often
attribute data is more important to the XML parser than to the
reader. Did you understand it now? Anyway, in the example above, the
person id is a counter value that is irrelevant to the reader, but
important to software that wants to manipulate the person element. |