User Guide

Table Of Contents
852 Chapter 35: Using XML and WDDX
About case-sensitivity and XML document objects
The tags and functions that create XML document objects let you specify whether ColdFusion
will treat the object in a case-sensitive manner. If you do not specify case-sensitivity, ColdFusion
ignores the case of XML document object component identifiers, such as element and attribute
names. If you do specify case-sensitivity, names with different cases refer to different components.
For example, if you do not specify case-sensitivity, the names mydoc.employee.name[1] and
mydoc.employee.NAME[1] always refer to the same element. If you specify case-sensitivity, these
names refer to two separate elements. You cannot use dot notation references for element or
attribute names in a case-sensitive XML document; for more information see “Referencing the
contents of an XML object” on page 852.
Using an XML object
Because an XML document object is represented as a structure, you can access XML document
contents using either, or a combination of both, of the following ways:
Using the element names, such as mydoc.employee.name[1]
Using the corresponding structure entry names (that is, XmlChildren array entries), such as
mydoc.employee.XmlChildren[1]
Similarly, you can use either, or a combination of both, of the following notation methods:
Structure (dot) notation, such as mydoc.employee
Associative array (bracket) notation, such as mydoc["employee"]
Referencing the contents of an XML object
Use the following rules when you reference the contents of an XML document object on the right
side of an assignment or as a function argument:
By default, ColdFusion ignores element name case. As a result, it considers the element name
MyElement and the element name myELement to be equivalent. To make element name
matching case-sensitive, specify
CaseSensitive="True" in the cfxml tag, or specify True as a
second argument in the
XmlNew or XmlParse function that creates the document object.
If your XML object is case sensitive, do not use dot notation to reference an element or
attribute name. Use the name in associative array (bracket) notation, or a reference that does
not use the case-sensitive name. For example, do not use names such as the following:
MyDoc.employee.name[1]
MyDoc.employee.XmlAttributes.Version
Instead, use names such as the following:
MyDoc.xmlRoot.XmlChildren[1]
MyDoc.xmlRoot["name"][1]
MyDoc.["employee"]["name"][1]
MyDoc.xmlRoot.XmlAttributes["Version"]
MyDoc["employee"].XmlAttributes["Version"]