Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 1070

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
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"]
Important: Because ColdFusion always treats variable names as case-insensitive, using dot notation for element and
attribute names in a case-sensitive XML document can generate unexpected results (such as all-uppercase variable
names), exceptions, or both.
• If your XML object is case sensitive, you cannot 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 (such as
XmlChildren[1]) instead.
• Use an array index to specify one of multiple elements with the same name; for example,
#mydoc.employee.name[1] and #mydoc.employee.name[2]
If you omit the array index on the last component of an element identifier, ColdFusion treats the reference as the
array of all elements with the specified name. For example,
elements.
• Use an array index into the
mydoc.XmlRoot.XmlChildren[1]
• Use associative array (bracket) notation to specify an element name that contains a period or colon; for example,
myotherdoc.XmlRoot["Type1.Case1"]
• You can use DOM methods in place of structure entry names.
For example, the following variables all reference the
simple XML
document" on page 1059:
mydoc.XmlRoot.XmlChildren[1].XmlChildren[1].XmlText
mydoc.employee.name[1].first.XmlText
mydoc.employee.name[1]["first"].XmlText
mydoc["employee"].name[1]["first"].XmlText
mydoc.XmlRoot.name[1].XmlChildren[1]["XmlText"]
The following variables all reference the EmpType attribute of the first name element in the XML document created
in
"A simple XML
document" on page 1059:
mydoc.employee.name[1].XmlAttributes.EmpType
mydoc.employee.name[1].XmlAttributes["EmpType"]
mydoc.employee.XmlChildren[1].XmlAttributes.EmpType
mydoc.XmlRoot.name[1].XmlAttributes["EmpType"]
mydoc.XmlRoot.XmlChildren[1].XmlAttributes.EmpType
Neither of these lists contains a complete set of the possible combinations that can make up a reference to the value or
attribute.
Assigning data to an XML object
When you use an XML object reference on the left side of an expression, most of the preceding rules apply to the
reference up to the last element in the reference string.
array to specify an element without using its name; for example,
XmlChildren
.
.
XmlText
Last updated 1/20/2012
.
refers to an array of two name
mydoc.employee.name
value "Almanzo" in the XML document created in
1065
"A

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents