xmlDelete

Deletes every child element with a given name from an XML node and returns the node.

xmlDelete(xmlNode, key) → returns xml

This function requires Adobe ColdFusion 2021 and up.  Not supported on Lucee, etc.

Argument Reference

xmlNode xml
Required

The XML document or element to delete from. Adobe's docs call this xmlObject, but CF2025 only accepts xmlNode as a named argument.

key string
Required

Name of the child elements to delete. Adobe's docs call this childName, but CF2025 only accepts key as a named argument.

Examples
Sample code invoking the xmlDelete function

Both a elements are removed, leaving only b.

xmlDelete(xmlParse("<root><a/><b/><a/></root>").root, "a").xmlChildren[1].xmlName

Expected Result: b

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub