User Guide

Table Of Contents
858 Chapter 35: Using XML and WDDX
Modifying a ColdFusion XML object
As with all ColdFusion structured objects, you can often use a number of methods to change the
contents of an XML document object. For example, you often have the choice of using an
assignment statement or a function to update the contents of a structure or an array. The
following section describes the array and structure functions that you can use to modify an XML
document object. The section “XML document object management reference” on page 860
provides a quick reference to modifying XML document object contents. Later sections describe
these methods for changing document content in detail.
Functions for XML object management
The following table lists the ColdFusion array and structure functions that you can use to manage
XML document objects and their functions, and describes their common uses. In several cases
you can use either an array function or a structure function for a purpose, such as for deleting all
of an element’s attributes or children.
Function Use
ArrayLen
Determines the number of child elements in an element, that is, the number
of elements in an element’s
XmlChildren array.
ArrayIsEmpty
Determines whether an element has any elements in its XmlChildren array.
StructCount
Determines the number of attributes in an element’s XmlAttributes
structure.
StructIsEmpty
Determines whether an element has any attributes in its XmlAttributes
structure.
Returns
True if the specified structure, including the XML document object
or an element, exists and is empty.
StructKeyArray
StructKeyList
Gets an array or list with the names of all of the attributes in an element’s
XmlAttributes structure. Returns the names of the children of an XML
element.
ArrayInsertAt
Adds a new element at a specific location in an element’s XmlChildren array.
ArrayAppend
ArrayPrepend
Adds a new element at the end or beginning of an element’s XmlChildren
array.
ArraySwap
Swaps the children in the XmlChildren array at the specified position.
ArraySet
Sets a range of entries in an XmlChildren array to equal the contents of a
specified element structure. Each entry in the array range will be a copy of
the structure. Can be used to set a single element by specifying the same
index as the beginning and end of the range.
ArrayDeleteAt
Deletes a specific element from an element’s XmlChildren array.
ArrayClear
Deletes all child elements from an element’s XmlChildren array.