Cisco Cisco Process Orchestrator 3.1 User Guide

Page of 786
 
7-6
Cisco Process Orchestrator 3.1 User Guide
 
Chapter 7      Advanced Authoring Concepts 
  Using Core Activities
XPath Example Syntax
The following expressions can be used when selecting nodes in a path expression.
XPath Query Example
The following is an example of source XML.
The following example path expressions and related results are based on the preceding source XML. 
For additional examples, see 
.
Path Expression
Description
nodename
Selects all child nodes of the named node
/
Selects from the root node
//
Selects nodes in the document from the current node that match the selection 
no matter where they are
.
Selects the current node
..
Selects the parent of the current node
@
Selects attributes
Example XML
<?xml version=”1.0” encoding=”ISO-8859-1”?>
<bookstore>
<book>
  <title lang=”eng”>Harry Potter</title>
  <price>29.99</price>
</book>
<book>
  <title lang=”eng”>Learning XML</title>
  <price>39.95</price>
</book>
</bookstore>
Path Expression
Description
bookstore
Selects all child nodes of the bookstore element 
/bookstore
Selects the root element bookstore
Note
If the path starts with a slash ( / ) it always 
represents an absolute path to an element.
bookstore/book
Selects all book elements that are children of bookstore
//book
Selects all book elements no matter where they are in the 
document 
bookstore//book 
Selects all book elements that are descendant of the 
bookstore element, no matter where they are under the 
bookstore element 
//@lang
Selects all attributes that are named lang