User Guide

Table Of Contents
Modifying a ColdFusion XML object 861
Changing contents of an element
Use the following techniques to change the contents of an element:
Attribute All attributes:
StructDelete(xmlElemPath, XmlAttributes)
A specific attribute:
StructDelete(xmlElemPath.XmlAttributes,
"attributeName")
Not available
Child
element
All children of an element:
StructDelete(xmlElemPath, "XmlChildren")
or
ArrayClear(xmlElemPath.XmlChildren)
All children with a specific name:
StructDelete(xmlElementpath,
"elemName")
ArrayClear(xmlElemPath.elemName)
A specific child:
ArrayDeleteAt(xmlElemPath.XmlChildren,
position)
ArrayDeleteAt(xmlElemPath.elemName,
position)
Not available
Type Using a function Using an assignment statement
Property
StructUpdate(xmlElemPath,
"propertyName", "value")
xmlElemPath.propertyName =
"value"
xmlElemPath["propertyName"] =
"value"
Attribute
StructUpdate(xmlElemPath.XmlAttributes,
"attributeName", "value")
xmlElemPath.XmlAttributes.
attributeName="value"
xmlElemPath.XmlAttributes
["attributeName"] = "value"
Child
element
(replace)
ArraySet(xmlElemPath.XmlChildren,
index,
index, newElement)
(use the same value for both index entries to
change one element)
Replace first or only child named
elementName:
parentElemPath.elementName =
newElement
parentElemPath["elementName"]
= newElement
Replace a specific child named
elementName:
parentElemPath.elementName
[index] = newElement
or
parentElemPath["elementName"]
[index] = newElement
Type Using a function Using an assignment statement