<!--- Create a blank ColdFusion XML document for actresses. ---> <cfset xmlActresses = XmlNew() /> <!--- Create a new XML node that we will use as the XML root. All other nodes in the document will live under this node. ---> <cfset xmlRoot = XmlElemNew( xmlActresses, "", "actresses" ) /> <!--- Set the new root element as the root node of our actresses DOM. ---> <cfset xmlActresses.xmlRoot = xmlRoot /> <!--- Create a new actress node element. ---> <cfset xmlActress = XmlElemNew( xmlActresses, "", "actress" ) /> <!--- Set some of the actress properties. ---> <cfset xmlActress.XmlAttributes.Name = "Maria Bello" /> <cfset xmlActress.XmlAttributes.HowSexy = "Too Sexy" /> <!--- Append the actress node to the child nodes of the root (Actresses). Notice here that we are using the xmlRoot that was generated above and the xmlActress node that we just created for Maria Bello. ---> <cfset ArrayAppend( xmlRoot.XmlChildren, xmlActress ) /> <!--- Now that we have added the new Actress node to the XML DOM, let's try to update some of its values without going back into the XML document path. ---> <cfset xmlActress.XmlAttributes.BirthDay = "18 April, 1967" /> <cfset xmlActress.XmlAttributes.Hair = "Blonde" /> <!--- Now, let's add some attributes, but this time, instead of referencing our Actress xml node, let's go back through the XML DOM. ---> <cfset xmlActresses.Actresses.Actress.XmlAttributes.Eyes = "Brown" /> <cfset xmlActresses.Actresses.Actress.XmlAttributes.Smile = "Sly" /> <!--- Now, let's dump out our actress node. ---> <cfdump var="#xmlActress#" label="xmlActress Node" /> <!--- Let's dump out our actresses XML DOM. If the nodes are passed by reference when using ArrayAppend(), then the CFDump above should be reflected in the CFDump below. ---> <cfdump var="#xmlActresses#" labe="xmlActressed DOM" />