xmlDOMGet

Version 22.0.8473


xmlDOMGet

Version 22.0.8473


XML ドキュメントから値をGet。

必要なパラメータ

  • 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.

オプションのパラメータ

  • uri:XML ファイルのURI。
  • handle:指定されたXML リーダーのハンドル。
  • repeatelement#:エレメントへのXPath でドキュメントで繰り返されるもの(例えば、/rss/channel/item)。
  • repeatmode: The push mode. The allowed values are ITEM and ARRAY. The default value is ITEM.

Output Attributes

  • *:それぞれのアイテムエレメント内で見つけられるエレメントおよびアトリビュート。

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 CData 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, CData Arc pushes the file with the newly added headers as output down the flow.