Obtaining a Portion of an XML Document

Usually, you use a query to obtain a portion of an XML document. To obtain the particular elements that you want, you must understand how to obtain an element that is a child of the document element. With this information, you can obtain any elements in the document.

The following figure shows how the XPath processor interprets the /bookstore/book query:

When the XPath processor starts its search at the root node, there is only one element among the immediate children of the root node. This is the document element. In this example, bookstore is the document element.

The query in this figure returns the book elements that are children of bookstore. This query does not return the my:book element, which is also a child of bookstore.

Now you can define queries that obtain any elements you want. For example:

/bookstore/book/title
               

            

This query returns title elements contained in book elements that are contained in bookstore.

Convert EDIFACT to XML Schema

Convert EDIFACT to XML with Stylus Studio's XML Schema and legacy data integration tools.

Editing XSL Stylesheets

Learn how our powerful XSL stylesheet editor with built-in preview capabilities and synchronized visual and text-based stylesheet editors simplifies XSL and XSLT stylesheet development.

XSV - The XML Schema Validator

XSV is the official reference implementation for the XML Schema language and Stylus Studio is the only XML IDE to provide seamless integration with XSV - the W3C XML Schema Validator. Download Stylus Studio and XSV today.

XML-DEV Discussion Forum

XML-DEV is a leading technical forum for XML discussion and a valuable free XML learning resource. Subscribe to the XML-DEV email discussion forum today to help further your XML education.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member