> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# xmlOpen

> URI または静的テキストからXML データの読み取り可能なハンドルを作成し、後続のオペレーションで使用できるようにします。

URI または静的テキストからXML データの読み取り可能なハンドルを作成します。このオペレーションは、静的なXML データ、パブリックURI からのXML データ、または別のオペレーションのアウトプットからのXML データを読み取る必要がある場合に役立ちます。

## 必要なパラメータ

* なし

## オプションのパラメータ

* **uri**：XML ファイルのURI（例：`http://mydomain.com/resources/somedata.xml` または `/tmp/myfile.xml`）。
* **text**：XML テキスト。ArcScript アトリビュートに設定された静的なXML、またはスクリプト内の前のオペレーションのアウトプット（http オペレーションの`[http:content]` アウトプット属性など）を指定できます。以下の例を参照してください。

## アウトプット属性

* **handle**：XML データへの読み取り可能なハンドル参照。このハンドルは後続のオペレーションで使用できます（以下の例を参照してください）。

## 例

```xml theme={null}
<!-- 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>xmlOpen を使用する際は、開いたままのハンドルによるメモリリークを避けるため、スクリプトの最後で対応する[xmlClose](./op-xml-close) オペレーションを使用してハンドルをクローズしてください。</Note>
