XmlParse |
|
 |
Description
|
Converts an XML document that is represented as a string variable into an XML document object.
|
|
Returns
|
An XML document object.
|
|
Category
|
Conversion functions, Extensibility functions, XML functions
|
|
Function syntax |
XmlParse(xmlString [, caseSensitive ] )
|
|
See also
|
cfxml, IsXmlDoc, XmlChildPos, XmlChildPos, XmlFormat, XmlNew, XmlSearch, XmlTransform
|
|
History
|
ColdFusion MX: Added this function.
|
|
Parameters
|
|
Parameter |
Description |
xmlString |
An XML document object string |
caseSensitive |
yes: maintains the case of document elements and attributes |
|
no. Default. |
|
|
Usage
|
The caseSensitive attribute value determines whether identifiers whose characters are of varying case, but are otherwise the same, refer to different components. For example:
- If caseSensitive = "no", the names mydoc.employee.name[1] and mydoc.employee.NAME[1] refer to the same element
- If caseSensitive = "yes", these names refer to two distinct elements
|
If the XML document is represented by a string variable, use the XmlParse tag directly on the variable. For example, if your application uses cfhttp action="get" to get the XML document, use the following code to create the XML document object:
<cfset myXMLDocument = XmlParse(cfhttp.fileContent)>
|
If the XML document is in a file, use the cffile tag to convert the file to a CFML variable, then use the XmlParse tag on the resulting variable. For example, if the XML document is in the file C:\temp\myxmldoc.xml, use the following code to convert the file to an XML document object:
<cffile action="read" file="C:\temp\myxmldoc.xml" variable="XMLFileText">
<cfset myXMLDocument=XmlParse(XMLFileText)>
Note: |
If the file is not encoded with the ASCII or Latin-1 character encoding, use the cffile tag charset attribute to specify the file's character encoding. For example, if the file is encoded in UTF, specify charset="UTF-8". |
|