The following table lists the ColdFusion tag (cfxml
) and functions that create and manipulate XML documents
Tag or function |
Description |
---|---|
<cfxml variable="objectName" [caseSensitive="Boolean"]> |
Creates a new ColdFusion XML document object consisting of the markup in the tag body. The tag can include XML and CFML tags. ColdFusion processes all CFML in the tag body before converting the resulting text to an XML document object. If you specify the CaseSensitive="True" attribute, the case of names of elements and attributes in the document is meaningful. The default is False.For more information on using the cfxml tag, see "Creating a new XML document object using the cfxml tag". |
XmlParse("XMLStringVar" [, caseSensitive]) |
Converts an XML document that is represented as a string variable into an XML document object. If you specify the optional second argument as True, the case of names of elements and attributes in the document is meaningful. The default is False. For more information on using the XmlParse function, see "Creating an XML document object from existing XML". |
XmlNew([caseSensitive]) |
Returns a new, empty XML document object. If you specify the optional argument as True, the case of names of elements and attributes in the document is meaningful. The default is False. For more information on using the XmlNew function, see"Creating a new XML document object using the XmlNew function". |
XmlElemNew(objectName, "elementName") |
Returns a new XML document object element with the specified name. For more information on using the XmlElemNew function, see "Adding an element". |
XmlChildPos(element, "elementName", position) |
Returns the position (index) in an XmlChildren array of the Nth child with the specified element name. For example, XmlChildPos(mydoc.employee, "name", 2) returns the position in mydoc.employee.XmlChildren of the mydoc.employee.name[2] element. This index can be used in the ArrayInsertAt and ArrayDeleteAt functions. For more information on using the XmlChildPos function, see "Determining the position of a child element with a common name", "Adding an element", and "Deleting elements". |
XMLTransform(XMLVar, XSLTStringVar) |
Applies an Extensible Stylesheet Language Transformation (XSLT) to an XML document. The document can be represented either as a string variable or as an XML document object. The function returns the resulting XML document as a string. For more information on using the XmlTransform function, see "Transforming documents with XSLT". |
XMLSearch(objectName, "XPathExpression") |
Uses an XPath expression to search an XML document object and returns an array of XML elements that match the search criteria. For more information on using the XmlSearch. function, see "Extracting data with XPath" |
IsXmlDoc(objectName) |
Returns True if the function argument is an XML document object. |
IsXmlElem(elementName) |
Returns True if the function argument is an XML document object element. |
IsXMLRoot(elementName) |
Returns True if the function argument is the root element of an XML document object. |
ToString(objectName) |
Converts an XML document object to a string representation. |
Note: The tags and functions that create XML document objects let you specify whether ColdFusion will treat the object in a case-sensitive manner. If you do not specify case-sensitivity, ColdFusion ignores the case of XML document object component identifiers, such as element and attribute names. If you do specify case-sensitivity, names with different cases refer to different components. For example, if you do not specify case-sensitivity, the names mydoc.employee.name[1] and mydoc.employee.NAME[1] always refer to the same element. If you specify case-sensitivity, these names refer to two separate elements.