24.08.2015 Views

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Querying Documents | 310Running XPath ExpressionsThis section explains possible ways of running an XPath expression on an <strong>XML</strong> document.What is XPathXPath is a language for addressing specific parts of an <strong>XML</strong> document. XPath, like the Document Object Model (DOM),models an <strong>XML</strong> document as a tree of nodes. An XPath expression is a mechanism for navigating through and selectingnodes from the <strong>XML</strong> document. An XPath expression is in a way analogous to a Structured Query Language (SQL)query used to select records from a database.There are different types of nodes, including element nodes, attribute nodes and text nodes. XPath defines a way tocompute a string-value for each type of node.XPath defines a library of standard functions for working with strings, numbers and boolean expressions.Some examples:• child::* - Selects all children of the root node.• .//name - Selects all elements having the name "name", descendants of the current node.• /catalog/cd[price>10.80] - Selects all the cd elements that have a price element witha value larger than 10.80.To find out more about XPath, the following URL is recommended: http://www.w3.org/TR/xpath.<strong>Oxygen</strong>'s XPath ConsoleTo use XPath effectively requires an understanding of the XPath Core Function Library. The <strong>Oxygen</strong> <strong>XML</strong> XPathexpression field of the current editor toolbar can be used to aid you in <strong>XML</strong> document development.In <strong>Oxygen</strong> <strong>XML</strong> an XPath 1.0 or XPath 2.0 expression is typed and executed on the current document from the menu<strong>XML</strong> > XPath (Ctrl+Shift+X) ( (Cmd+Shift+X on Mac OS)) or from the toolbar button . Both XPath 2.0 basicand XPath 2.0 schema aware expressions can be executed in the XPath console. XPath 2.0 schema aware also takes intoaccount the Saxon EE <strong>XML</strong> Schema version option. The XPath console features a syntax highlight mechanism thatallows you to better identify the components of the XPath expression. You can customize the color scheme from theSyntax Highlight options page.The content completion assistant that helps entering XPath expressions in attributes of XSLT stylesheets elements isalso available in the XPath console. It offers context dependent proposals according with the cursor position in the editeddocument. The set of XPath functions proposed by the assistant also depends on the XPath version selected from thedrop-down menu of the XPath button (1.0 or 2.0).In the following figure the content completion assistant offers element names from the current document and all XPath2.0 functions:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!