<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>XMLGETNODETYPE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">XMLGETNODETYPE</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">Description</span>
<p>
Determines the type of an XML document object node. 
</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">Returns</span>
<p>
A string identifying the XML node type. The following values are valid:
</p>

<p>

</p>

<p>
If the argument is not a document object node, the function generates an error.
</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">Category</span>
<p>
XML functions
</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">Function syntax</span><pre>XmlGetNodeType(xmlNode)
</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">See also</span>
<p>
IsXmlAttribute, IsXmlDoc, IsXmlElem, IsXmlNode, IsXmlRoot, XmlChildPos, XmlValidate; Chapter&#160;35, "Using XML and WDDX" in ColdFusion MX Developer's Guide
</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">History</span>
<p>
ColdFusion&#160;MX&#160;7: Added this function.
</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">Parameters</span>
<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">Usage</span>
<p>
The XmlGetNodeType function can determine the types of the nodes returned by the XmlSearch function, or the types of the entries in an element's XmlNodes array. 
</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">Example</span>
<p>
The following example checks the node types of various parts of an XML document object:
</p>
<pre>&lt;!--- Create an XML document object ---&gt;
&lt;cfxml variable=&quot;xmlobject&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;order id=&quot;4323251&quot;&gt;
   &lt;customer firstname=&quot;Philip&quot; lastname=&quot;Cramer&quot; accountNum=&quot;21&quot;/&gt;
   &lt;items&gt;
      &lt;item id=&quot;43&quot;&gt;
         &lt;!-- This item is coded to show several node types --&gt;
         &lt;![CDATA[&quot;Our Best&quot; hammer &amp; chisel set!!!]]&gt; Imported from France
         &lt;quantity&gt;1&lt;/quantity&gt;
         &lt;unitprice&gt;15.95&lt;/unitprice&gt;
      &lt;/item&gt;
   &lt;/items&gt;
&lt;/order&gt;
&lt;/cfxml&gt;

&lt;!--- Display the node types ---&gt;
&lt;cfoutput&gt;
  &lt;h3&gt;Node Types&lt;/h3&gt;
  xmlobject: #XMLGetNodeType(xmlobject)#&lt;br&gt;
  xmlobject.order: #XMLGetNodeType(xmlobject.order)#&lt;br&gt;
  &lt;br&gt;
  Now check the types of all the nodes in the xmlobject.order.items.item 
    element's XmlNodes array.&lt;br&gt;
   Note the many apparently empty Text nodes generated by whitespace characters 
in the XML text source.&lt;br&gt;&lt;br&gt;
  &lt;cfset descnodes=xmlobject.order.items.item.XmlNodes&gt;
&lt;cfloop from=&quot;1&quot; to=&quot;#ArrayLen(descnodes)#&quot; index=&quot;i&quot;&gt;
   #i# Node type is: #XMLGetNodeType(descnodes[i])#&lt;br&gt;
   #i# Node name is: #descnodes[i].XmlName#&lt;br&gt;
   &lt;cfif (descnodes[#i#].XmlValue NEQ &quot;&quot;)&gt;
      #i# Node value is: #descnodes[i].XmlValue#&lt;br&gt;
   &lt;/cfif&gt;
   &lt;br&gt;
  &lt;/cfloop&gt;
&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>

<p>ATTRIBUTE_NODE</p>

<p>CDATA_SECTION_NODE</p>

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

<p>COMMENT_NODE</p>

<p>DOCUMENT_FRAGMENT_NODE</p>

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

<p>DOCUMENT_NODE</p>

<p>DOCUMENT_TYPE_NODE</p>

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

<p>ELEMENT_NODE</p>

<p>ENTITY_NODE</p>

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

<p>ENTITY_REFERENCE_NODE</p>

<p>NOTATION_NODE</p>

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

<p>PROCESSING_INSTRUCTION_NODE</p>

<p>TEXT_NODE</p>

  </td>
  </tr>
  </table>
</div>
<div id="XMLNODE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">XMLNODE</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>


<p>An XML DOM object node</p>

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

  </body>
</html>
