XmlElemNew  
Description
Creates an XML document object element.
 
Returns
An XML document object element.
 
Category
Extensibility functions, XML functions
 
Function syntax
XmlElemNew(xmlObj, childName)
 
See also
cfxml, IsXmlDoc, XmlChildPos, XmlFormat, XmlNew, XmlParse, XmlSearch, XmlTransform
 
History
ColdFusion MX: Added this function.
 
Parameters
 
Parameter      Description
xmlObj The name of an XML object. An XML document or an element.
childName The name of the element to create. This element becomes a child element of
  xmlObj in the tree.
 
Example
The following example creates and displays a ColdFusion document object. For more information on this example, see Chapter 31, "Using XML and WDDX," in Developing ColdFusion MX Applications.
<cfset testVar = True>
<cfscript>
   MyDoc = XmlNew();
   MyDoc.xmlRoot = XmlElemNew(MyDoc,"MyRoot");
   if (testVar IS TRUE)
      MyDoc.MyRoot.XmlText = "The value of testVar is True.";
   else 
      MyDoc.MyRoot.XmlText = "The value of testVar is False.";
   for (i = 1; i LTE 4; i = i + 1)
      {
      MyDoc.MyRoot.XmlChildren[i] = XmlElemNew(MyDoc,"childNode");
      MyDoc.MyRoot.XmlChildren[i].XmlText = "This is Child node " & i &".";
      }
</cfscript>
<cfdump var=#MyDoc#>
xmlObj  
The name of an XML object. An XML document or an element.
childName  
The name of the element to create. This element becomes a child element of xmlObj in the tree.