Use Of XmlFormat() in ColdFusion - 9
Hi All,
I found that XmlFormat() function does the formatting of the any Xml text and removes any XML unsafe characters from that XML text.
I just wrote below code to test this function.
<cfsavecontent variable="x" >
<?xml version = "1.0"?>
<someXML>
<someElement someAttribute="'a quoted value'">
Body of element with <, >, "" and & goes here.
</someElement>
</someXML>
</cfsavecontent>
<cfset x = XmlFormat(x) />
<cfscript>
y = XmlParse(trim(x));
writeDump(y);
</cfscript>
Then I got another error message
An error occured while Parsing an XML document. | |
| Reference is not allowed in prolog. | |
I know that by replacing the special characters from the XML text by string replace functions everything will be fine. But, I want to know what is the exact use of XmlFormat() function.
Thanks in advance for any help. ![]()
