Starting at the Root Node

To specify that the XPath processor should start at the root node when it evaluates nodes for a query, insert a forward slash ( /) at the beginning of the query.

In an XML document, there is no text that corresponds to the root node. Externally, a root node is really a concept. Internally, there are data structures that represent this concept, but there is no text that you can point to and call a root node.

The following query instructs the XPath processor to start at the root node, as indicated by the forward slash at the beginning of the query.

/bookstore
               

            

This query searches the children of the root node for a bookstore element. Because the name of the document element is bookstore, the query returns it. If the name of the document element is not bookstore, this query returns an empty set.

The following query returns the entire document, starting with the root node. As you can see, the entire query is just a forward slash:

/
               

            

This query returns everything - comments, declarations, processing instructions, the document element, and any elements, attributes, comments, and processing instructions that the document element contains.

Text File to XML

Stylus Studio provides several easy-to-use document wizards that allow you to quickly convert text files to XML. Create XML from text and EDI, create XML Schema from EDIFACT, and more!

XML Videos

Stylus Studio online XML video demonstrations illustrate how easy it is to learn advanced XML editing techniques. Now playing: Java Code Generation, Convert to XML, Grid View, and many other informative video demonstrations.

Translating XML documents to X12

In-place, via XSLT and via XQuery are all mechanisms supported for converting XML to X12

XQuery Tutorial

This XQuery Tutorial is about "BUILDING XQUERY BASED WEB SERVICE AGGREGATION AND REPORTING APPLICATIONS".

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member