What are attributes?
Basically, the data in an XML document can be stored in two ways:
between the start tag and the end tag, or as the value of an
attribute defined inside the start tag. Here is a simple example,
where we put the same information but in three different ways:
<message>
<type>
email
</type>
<text>
I'll be back!
</text>
</message>
|
|
<message type="email">
I'll be back!
</message>
|
|
<message type="email" message="I'll be back!"/>
|
|
Traditionally, the second method is preferred. The element contains the
data aimed to the end-user, while the attributes are used for
processing the element content, adding to it meta-information.
|