Name

XmlParse

Synopsis

                  
                  
                  XmlParse(XML_string [, case_sensitive])

Converts an XML string to a ColdFusion XML document object. Setting the optional case_sensitive parameter to Yes causes ColdFusion to maintain the original case of the XML document elements and attributes. The default value for case_sensitive is No. The following example retrieves an XML file from the Macromedia web site and parses it into a ColdFusion XML document object:

<cfhttp URL="http://www.macromedia.com/devnet/resources/macromedia_resources.xml"
        method="Get">
   
<cfset DesDev = XmlParse(cfhttp.FileContent)>
   
<cfdump var="#devnet#">

Note that XML encoded in character sets other than ASCII or Latin-1 must have the character set explicitly defined to ColdFusion. If you are using the cffile tag to read an XML file, the character set can be defined using the charset parameter of the cffile tag. If the XML file is retrieved via another method, it may be necessary to first change the encoding.

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.