XML in Office 2003: Information Sharing with Desktop XML

Prev don't be afraid of buying books Next

17.4. Attributes

An address in XML document navigation is not a storage address like a file system path, despite the similarity in syntax. An XPath expression locates objects by their position in a document's structure and other properties, such as the values of attributes.

A diagram like Figure 17-2 should not present an attribute's information as a child of the element exhibiting the attribute. To do so would be incorrect, because attributes are not siblings of subelements. For this reason, XPath uses /@ to show the element/attribute relationship.

For example, the expression in Example 17-5 addresses all the values of the par elements' author attributes.

Example 17-5. Expression with an attribute

/book//par/@author

Example 17-6. Objects addressed by Example 17-5

bd cg pp bd

Amazon

Категории