Execute XML

Execute XML

Table of Contents

 Execute XML

The executeXPath Deluge task executes an XPath in the context of the specified XML and returns the value as a string. Here, XPath refers to the XML Path Language for finding information in an XML document. XML documents can be represented as a tree and XPath provides the ability to navigate this tree by selecting nodes by a variety of criteria. For example, in the following XML document,

- the XPath bookstore/book/title, selects all the title elements that are children of bookstore
- the XPath bookstore/book/title/text(), selects the text from all the title nodes
- the XPath bookstore/book[1]/title, selects only the title of the first book node under the bookstore element
- the XPath bookstore/book[price>35]/price, selects all the price nodes with a price higher than 35

<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore>

<book category="Mathematics">
<title lang="en">Femat's Enigma</title>
<author>Simon Singh</author>
<year>1998</year>
<price>15</price>
</book>

<book category="Business">
<title lang="en">Survival Is Not Enough</title>
<author>Seth Godin</author>
<year>2003</year>
<price>17.88</price>
</book>

<book category="Science">
<title lang="en">The God Delusion</title>
<author>Richard Dawkins</author>
<year>2006</year>
<price>6.98</price>
</book>

<book category="General">
<title lang="en">The Black Swan</title>
<author>Nassim Nicholas Taleb</author>
<year>2007</year>
<price>19.79</price>
</book>

</bookstore>

 Syntax

<variable> = <xml/string-variable>.executeXPath(<xpath>)

<variable> - the variable to hold the string value returned by the execute task.
<string/xml variable> - variable of type XML/string that holds the XML/JSON document
<xpath> - the xpath expression to select the specific nodes in an XML document.

 

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com