Creates an XML document object element
xmlElemNew(xmlobj [, namespace], childname)
→ returns xml
Here, we've created myXml with root and child nodes using xmlelemnew().
<cfset myXml = xmlNew()>
<cfset myXml.XmlRoot = xmlelemnew(myXml,"sampleXml")>
<cfset myXml.sampleXml.XmlText = "This is Root node text">
<cfloop from="1" to="3" index="i">
<cfset myXml.sampleXml.XmlChildren[i] = xmlelemnew(myXml,"childNode#i#")>
<cfset myXml.sampleXml.XmlChildren[i].XmlText = "This is Child node#i# text">
</cfloop>
<cfdump var="#myXml#">
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.