Inside Coldfusion MX

"-->

XmlElemNew (elem, childName)

Description

Creates a new XML element inside of an existing XML document at the specified position in the document.

Example

In this example, we use an XML file that is located on the test server. To try using this function, simply point the cffile to an XML file that exists on your server. You will also need to change the dot notation and child element to match your file.

<cffile action="read" file="d:\cfusionmx\wwwroot\xml\users.xml" variable="XMLFileText"> <cfset myXMLDocument=XmlParse(XMLFileText)> <cfdump var = #myXMLDocument#> <cfset ArrayAppend(myXMLDocument.Users.sysuser[1].XmlChildren, XmlElemNew(myXMLDocument,"phoneNumber"))> <cfdump var = #myXMLDocument#>

Категории