XPath Test provides access to data on the path specified in XML data.

Information about how the data access process takes place can be obtained with the XPath Test examples in the Samples section.

The image containing the XPath Test settings is given below:

Working Logic of XPath

XPath's logic is normally based on accessing the XML element. This is how XML Transformation works in Content Filter, Encryption and Signature policies screens.

Apinizer has customized the variable definition and policies other than XML Transformation, Content Filter, Encryption and Signature to facilitate the use of XPATH.

This customization is as follows:

Normally, the text value of the element can be obtained by adding the text() function to the end of the XPath path, while the text value of the XPath is taken by default in Apinizer.

An example XML data is below.

<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="cooking">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price currency="EUR">30.00</price>
  </book>
  <book category="children">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price currency="EUR">29.99</price>
  </book>
</bookstore>
CODE
  • The following XPath is run on this data.
/bookstore/book[2]/title
CODE
  • Normally, when XPath is run with any compiler other than Apinizer, the following result is returned.
<title>Harry Potter</title>
CODE
  • On the other hand, when Apinizer is run in XPath tool outside of the specified policies, the following result is returned.
Harry Potter
CODE