XPath

The XML Path Language (XPath) also models an XML document as a set of nodes. However, the hierarchy of nodes in the XPath representation of an XML document differs in several respects from the DOM representation.

XPath uses a path syntax to express the hierarchy of the content in an XML document. XPath bears similarities to the paths—hence the name XML Path Language—used to express the hierarchy of the file system on your computer.

The root node of an XPath document, which is equivalent to the document entity, is expressed as a single forward slash character (/). Nodes can then be accessed relative to the root node. For example, the document element of a document with a document element called myDocumentElement can be accessed using path syntax, /myDocumentElement.

XPath is intended for use with other XML specifications, such as XSLT and XForms (a new forms language expressed in XML). XPath specifies which part of an XML document is to be processed. For example, XPath can be used with XSLT to select a set of nodes that, not surprisingly, it terms a node-set. The node-set is then processed in one of the ways supported by the XSLT specification.

XPath is discussed in greater detail in Chapter 9, “The XML Path Language—XPath.”

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset