KickStart Tutorial XML by Jan Kampherbeek - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

XML Attributes

Attributes

Elements in XML can use attributes. The syntax is:

 

<element attribute-name = "attribute-value">....</element>

The value of an attribute needs to be quoted, even if it contains only numbers. An example
<car color = "green">volvo</car>

The same information can also be defined without using attributes: <car>
<brand>volvo</brand> <color>green</color>
</car>

Avoid attributes

When possible try to avoid attributes. Data structures are more easy described in XMLtags.
Software that checks XML-documents can do a better job with tags than with attributes.