xmlDOMGet

Version 22.0.8473


xmlDOMGet

Version 22.0.8473


Get values from an XML document.

Required Parameters

  • map:*: This set of inputs contains one or more mappings of an attribute name and an XPath that specifies the value or values to retrieve from the XML document. For example, the attribute name map:item that has a value of /rss/channel/item will push an attribute named item with the value or values of the items returned from the XPath.

Optional Parameters

  • uri: An XML file URI.
  • handle: The handle of the specified XML reader.
  • repeatelement#: The XPath to an element that is repeated in the document (for example, /rss/channel/item).
  • repeatmode: The push mode. The allowed values are ITEM and ARRAY. The default value is ITEM.

Output Attributes

  • *: The elements and the attributes found within each item element.

Example

Consider the XML data below, which is passed as input data to a Script Connector in CData Arc:

<Items>
  <Car>
    <Make>Subaru</Make>
    <Model>WRX</Model>
  </Car>
</Items>

In this Script Connector, you can invoke xmlDOMGet in ArcScript to retrieve the make and model of the car represented by this XML data and add them as headers to a message in Arc. The ArcScript code below shows an example of how to do this:

<arc:set attr="xml.uri" value="[FilePath]" />
<arc:set attr="xml.map:make" value="/Items/Car/Make"/>
<arc:set attr="xml.map:model" value="/Items/Car/Model"/>

<arc:call op="xmlDOMGet" in="xml" out="result">
  <arc:set attr="output.header:carmake" value="[result.make]" />
  <arc:set attr="output.header:carmodel" value="[result.model]" />
</arc:call>

<arc:set attr="output.filename" value="[Filename]" />
<arc:push item="output" /> 

After this code executes, Arc pushes the file with the newly added headers as output down the flow.