Get XML Document Data Step

Use the Get XML Document Data step after the Create XML Document step to obtain data from a document formatted with XML.

Get XML Document Data Customizer Window
Note

You can use the Get XML Document Data step only on a document that was returned by the Create XML Document step. If you attempt to use it on any other type of document, errors will occur.

A sample example that shows a few lines from a typical XML file, created with a text editor, which formats dynamic stock price data.

<?xml version="1.0" standalone="yes"?>
<STOCKLIST>
<STOCK symbol="MSFT" error="0">
<HIGH>58.0625</HIGH>
<PCT_CHANGE>0.67114094</PCT_CHANGE>
<LOW>55.1875</LOW>
<LAST>56.25</LAST>
<CHANGE>0.375</CHANGE>
<VOLUME>31,973,600</VOLUME>
<REC_STATUS>0</REC_STATUS>
<DATE>02/21/2001</DATE>
<TIME>15:52</TIME>
</STOCK>
</STOCKLIST>

To extract data from an XML file, you must identify the exact XML path, as in the example below:

Example shows a Typical XML Path

/descendant::STOCKLIST
/child::STOCK[attribute::symbol='CSCO']
/child::LAST

The XML path is composed of location steps separated by a forward slash (/). In the example above, the XML path has three location steps. Each location step is composed of three parts:

  • Axis—Relation to the context (for example, descendant or child).

  • Node test—Field name (for example, STOCK).

  • Predicates (optional)—Properties and values within a field (for example, [attribute::symbol='CSCO']).

Note

You must execute a separate Get XML Document Data step for each field in the XML file that you want to use.

The fallowing table describes the properties of the Get XML Document Data customizer window.

Property

Description

Document

Document variable created as the Result Document in a preceding Create XML Document step.

XML Path

XML path that defines a specific field or value in an XML document.

Result Data

Document variable that contains the XML data.

To use the Get XML Document Data customizer window to specify a document variable that will contain XML data, do the following procedure:

Procedure

 Command or ActionPurpose
Step 1

From the Document drop-down menu, choose the variable that stores the source document.

Step 2

In the XML Path field, enter a value directly or take one of the following actions:

  • From the XML Path drop-down menu, choose the variable that stores the XML Path value of the source document.

  • Click the Expression Editor (...) button and enter an expression that specifies the XML Path value of the source document.

Step 3

From the Result Data drop-down menu, choose the variable that stores the resulting XML document.

Note

Make sure that the Document variable you choose here matches the one you chose for the Result Document in a preceding Create XML Document step.

Step 4

Click OK.

The Get XML Document Data customizer window closes, and the names of the Result Data, Document, and XML Path variables appear next to the Get XML Document Data step icon in the Design pane of the Cisco Unified CCX  Editor.