Attributes

An attribute is the association of an attribute name with an attribute value. For example, the markup describing this book might be represented as follows:

<book edition="1"> 
<title>Sams Teach Yourself XML in 10 Minutes</title> 
</book> 

The book element has an edition attribute, which has the value of 1.

An attribute is allowed only in the start tag of an element. The value of an attribute must be enclosed between paired double quotation marks, such as

<book edition="1"> 

or between paired apostrophes:

<book edition='1'> 

It is an error to mix these two types of delimiters. The next two line of code would cause a well-formedness error because the delimiters of the attribute value are not paired.

In the following line, the quotation ...

Get Sams Teach Yourself XML in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.