User Guide

Table Of Contents
Modifying a ColdFusion XML object 859
Note: Array and structure functions not in the preceding or table or the table in the next section, do
not work with XML document objects, XML elements, or XML node structures.
Treating elements with the same name as an array
In many cases an XML element has multiple children with the same name. For example, the
example document used in this chapter has multiple name elements in the employee elements. In
many cases, you can treat the child elements with identical names as an array. For example, to
reference the second name element in mydoc.employee, you can specify
mydoc.employee.name[2]. However, you can only use a limited set of Array functions when you
use this notation. The following table lists the array functions that are valid for such references:
StructDelete
Deletes a selected attribute from an element’s XMLAttributes structure.
Deletes all children with a specific element name from an element’s
XmlChildren array.
Deletes all attributes of an element.
Deletes all children of an element.
Deletes a selected property value.
StructClear Deletes all attributes from an element’s XMLAttributes structure.
Duplicate Copies an XML document object, element, or node structure.
IsArray Returns True for the XmlChildren array. Returns false if you specify an
element name, such as mydoc.XmlRoot.name, even if there are multiple
name elements in XmlRoot.
IsStruct Returns False for XML document objects, elements, and nodes. Returns
True for
XmlAttributes structures.
StructGet Returns the specified structure, including XML document objects,
elements, nodes, and
XmlAttributes structures.
StructAppend Appends a document fragment XML document object to another XML
document object.
StructInsert Adds a new entry to an XmlAttributes structure.
StructUpdate Sets or replaces the value of a document object property such as XmlName,
or of a specified attribute in an
XmlAttributes structure.
Array function Result
IsArray(elemPath.elemName)
Always returns False.
ArrayClear(elemPath.elemName)
Removes all the elements with name elemName from the
elemPath element.
ArrayLen(elemPath.elemName)
Returns the number of elements named elemName in the
elemPath element.
ArrayDeleteAt(elemPath.elemName, n)
Deletes the nth child named elemlName from the elemPath
element.
Function Use