<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFXML</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFXML</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
タグ本文内のマークアップを含む ColdFusion XML ドキュメントを作成します。このタグには、XML タグおよび CFML タグを含めることができます。ColdFusion では、タグの本文に含まれている CFML コードを処理し、結果のテキストを XML ドキュメントオブジェクト変数に割り当てます。これは、常に Unicode で保管されます。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
拡張タグ
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;CFXML 
   variable=&quot;xmlVarName&quot; 
   caseSensitive=&quot;yes&quot;、&quot;no&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
IsXmlDoc、IsXmlElem、IsXmlRoot、ToString、XmlChildPos、XmlNew、XmlParse、XmlSearch、XmlTransform、『ColdFusion MX 開発ガイド』の第35章の「XML および WDDX の使用」 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">ヒストリ</span>
<p>
ColdFusion&#160;MX&#160;7: テキストの先頭で XML 宣言を使用できるようになりました。
</p>

<p>
ColdFusion&#160;MX: このタグが追加されました。
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">使用方法</span>
<p>
XML オブジェクトで大文字と小文字が区別される場合、ドット表記法を使用して要素または属性の名前を参照することはできません。代わりに、連想配列 (括弧) 表記法による名前を使用するか、大文字と小文字を区別する名前を使わない参照を使用 (xmlChildren[1] など) します。次のコードで、最初の行は大文字と小文字を区別する XML オブジェクトに機能します。2 番めと 3 番めの行ではエラーが発生します。
</p>
<pre>MyDoc.xmlRoot.XmlAttributes[&quot;Version&quot;] = &quot;12b&quot;;
MyDoc.xmlRoot.XmlAttributes.Version = &quot;12b&quot;;
MyDoc.MyRoot.XmlAttributes[&quot;Version&quot;] = &quot;12b&quot;;
</pre>
<p>
XmlFormat 関数を使用して、&amp;、&gt;、&lt; などの特殊文字をエスケープします。
</p>

<p>
XML ドキュメントオブジェクトを文字列に戻すには、ColdFusion で &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt; XML 宣言が自動的に先頭に挿入されるときに ToString 関数を使用します。
</p>

<p>
宣言を変更して、別のエンコーディングを指定するには、Replace 関数を使用します。ブラウザや他のアプリケーションに返されるテキストのエンコーディングを指定するには、cfcontent タグを使用します。 
</p>

<p>
次の例は、この処理を示しています。
</p>
<pre>&lt;cfprocessingdirective suppresswhitespace=&quot;Yes&quot;&gt;
&lt;cfcontent type=&quot;text/xml; charset=utf-16&quot;&gt;
&lt;cfxml variable=&quot;xmlobject&quot;&gt;
&lt;breakfast_menu&gt;
   &lt;food&gt;
      &lt;name quantity=&quot;50&quot;&gt;Belgian Waffles&lt;/name&gt;
      &lt;description&gt;Our famous Belgian Waffles&lt;/description&gt;
   &lt;/food&gt;
&lt;/breakfast_menu&gt;
&lt;/cfxml&gt;

&lt;!--- &lt;cfdump var=&quot;#xmlobject#&quot;&gt;---&gt;

&lt;cfset myvar=toString(xmlobject)&gt;
&lt;cfset mynewvar=replace(myvar, &quot;UTF-8&quot;, &quot;utf-16&quot;)&gt;

&lt;!---&lt;cfdump var=&quot;#mynewvar#&quot;&gt;---&gt;

&lt;cfoutput&gt;#mynewvar#&lt;/cfoutput&gt;
&lt;/cfprocessingdirective&gt;
</pre>
<p>
cfprocessingdirective タグを使用することにより、ColdFusion が XML 宣言の前に空白文字を置かないようにすることができます。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span>
<p>
次の例では、ルート要素が MyDoc であるドキュメントオブジェクトを作成します。このオブジェクトには、ColdFusion 変数 testVar の値を示すテキストが含まれています。コード例では、4 つのネストされた子要素を作成します。これらはインデックスが付けられた cfloop タグを使用して生成できます。cfdump タグを使用して、XML ドキュメントオブジェクトを表示します。
</p>
<pre>&lt;cfset testVar = True&gt;
&lt;cfxml variable=&quot;MyDoc&quot;&gt;
   &lt;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39; ?&gt;
   &lt;MyDoc&gt;
      &lt;cfif testVar IS True&gt;
         &lt;cfoutput&gt;testVar の値は True です。&lt;/cfoutput&gt;
      &lt;cfelse&gt;
         &lt;cfoutput&gt;testVar の値は False です。&lt;/cfoutput&gt;
      &lt;/cfif&gt;
      &lt;cfloop index = &quot;LoopCount&quot; from = &quot;1&quot; to = &quot;4&quot;&gt;
         &lt;childNode&gt;
            これは子ノード &lt;cfoutput&gt;#LoopCount# です。&lt;/cfoutput&gt;
         &lt;/childNode&gt;
      &lt;/cfloop&gt;
   &lt;/MyDoc&gt;
&lt;/cfxml&gt;
&lt;cfdump var=#MyDoc#&gt;
</pre>
<p>

</p>

         </td>
      </tr>
   </table>
   </div>
<div id="VARIABLE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">VARIABLE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">&#160;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ドキュメントオブジェクトの名前です。</p>

  </td>
  </tr>
  </table>
</div>
<div id="CASESENSITIVE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">CASESENSITIVE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "no"

<ul>

<li>yes: ドキュメント要素と属性の大文字と小文字の区別を保持します。</li>

<li>no</li>
</ul>


  </td>
  </tr>
  </table>
</div>

  </body>
</html>
