Creates an XML document object.
Extensibility functions,
XML functions
XmlNew([caseSensitive])
cfxml,
IsXmlDoc,
XmlChildPos,
XmlChildPos,
XmlFormat,
XmlParse,
XmlSearch,
XmlTransform
New in ColdFusion MX: this function is new.
Parameter | Description |
---|---|
caseSensitive |
Determines how ColdFusion processes the case of XML document object component identifiers
|
An XML document object is represented in ColdFusion as a structure.
The caseSensitive
attribute value determines whether identifiers whose characters are of varying case, but are otherwise the same, refer to different components. For example:
caseSensitive = "no"
, the names mydoc.employee.name[1] and mydoc.employee.NAME[1] refer to the same element
caseSensitive = "yes"
, these names refer to two distinct elementsThe following example creates and displays a ColdFusion document object. For more information on this example, see Developing ColdFusion MX Applications with CFML.
<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#>