Obtaining All Marked-Up Text

When you query a document, you do not usually want to obtain all marked-up text. However, an understanding of queries that return all marked-up text makes it easier to define a query that retrieves just what you want.

The following figure shows a complete query ( /bookstore) and the way the XPath processor interprets it:

This query returns the bookstore element. Because the bookstore element is the document element, which contains all elements and attributes in the document, this query returns all marked-up text.

In the query, the initial forward slash (/) instructs the XPath processor to start its search at the root node.

Suppose you run the following query on bookstore.xml:

/book
               

            

This query returns an empty set. It searches the immediate children of the root node for an element named book. Because there is no such element, this query does not return any marked-up text. Note that this query does not return an error. The query runs successfully, but the XPath processor does not find any elements that match the query. All book elements are grandchildren of the root node, and the XPath processor only checks the children of the root node.

Database-to-XML Mapping

Stylus Studio features several database-to-XML mapping tools that allow you to easily query a relational database using SQL/XML or SQL and render the results as XML. Stylus Studio also supports the world's first and only visual SQL/XML Editor!

Generate XSD

Stylus Studio® can generate an industry standard W3C XSD (or DTD) by correctly inferring an XML data model from an XML instance document.

Generating Java Code with Stylus Studio

This is a video tutorial on how to generate Java Code with Stylus Studio

Stylus Studio's Advanced XQuery Mapper Features

Learn how to create an advanced XQuery expression in the XQuery mapper, specifying operations, constants, and ports, for use in conditional blocks and FLWR expressions. Free online video demonstration!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member