xmlOpen

Version 24.3.9106


xmlOpen


Create a readable handle for XML data from a URI or static text. This operation is useful when there is a need to read static XML data, XML data from a public URI or XML data from the output from another operation.

必要なパラメータ

  • None

オプションのパラメータ

  • uri:XML ファイルのURI(例:http://mydomain.com/resources/somedata.xml または/tmp/myfile.xml)。
  • text:XML テキスト。This can be static XML that is set on an ArcScript attribute or the output from a previous operation in the script (such as the [http:content] output attribute of one of the http operations). See the example below.

アウトプット属性

  • handle:A readable handle reference to the XML data. This handle can be used by subsequent operations (see the example below).

<!-- Setting a static XML text -->
<arc:set attr="xml.text" value='<Items><foo>bar</foo></Items>' />
<arc:call op="xmlOpen" in="xml" out="output" >
  <!-- Setting the xml handle as an attribute on a new item that is passed into a second operation  -->
  <arc:set attr="xml2.handle" value="[output.handle]" />
  <arc:set attr="xml2.map:value1" value="/Items/foo" />
  <arc:call op="xmlDOMGet" in="xml2" out="output2" >
    <!-- Here is where you can execute additional script for the operation that is using the handle -->
    <!-- This example logs the value of the foo element from the xml text to the application log, which is "bar" -->
    <arc:set attr="_log.info" value="[output2.value1]" />
  </arc:call>
  <arc:finally>
    <!-- Close the xml handle -->
    <arc:call op="xmlClose" in="xml2" />
  </arc:finally>
</arc:call>

Note: When you use xmlOpen, make sure to use the corresponding xmlClose operation to close the handle at the end of the script to avoid leaking memory through open handles.