User Tools

Site Tools



XPATH uses XPath path expressions to select nodes or node-sets in an XML document.

XPath is a standard xml query language with many references and tutorials available on the internet. XPATH supports XPath version 1.0.

Essential Parameters:
Query:The XPath query to run, which may contain DORs
Optional Parameters:
Value:This should be used if the xml to parse is in a SCALAR DOR.
File:This should be used if the xml to parse is in file
Show Complete Results:If the query matches a node, this allows child nodes to be returned also. (default→TRUE).
Show Attribute Values:When matching an attribute the query can return: Name, Value or both. (default→Value).
Use Namespaces:If you are dealing with large xml files that do not use namespaces, setting this to false can improve performance.
Default Namespace Prefix:If the xml file contains entries such as xmlns=”…, rather than xmlns:mynamespace=”…, then this parameter allows a default namespace to be specified. You can then use that namespace within your Xpath queries.
Encoding:This is used in conjunction with the File: parameter to specify the file type. The default type is 'UTF-8'
Delimiter:Character to act as delimiter in DOR in Value:. Replaces default→'%'.

Our example follows the example at the external page:

Create the xml file “bookstore.xml” below:

<?xml version="1.0" encoding="UTF-8"?>
   <title lang="en">Harry Potter</title>
   <title lang="en">Learning XML</title>
ExampleOutput Values
Query:/bookstore/book[1]/title/child::text() Harry Potter
Query:/bookstore/book[1] <book> <title> Harry Potter</title><price> 29.99</price></book>
Query:/bookstore/book[1]/title/@lang en
Show Complete Results: NO
<title lang=“en”/>

The Tree and EASAP output for these four Query: parameters:

Page Tools