XMLParse() -allowing &nsbp;

Using Coldfusion8, I am parsing some xhtml via the XMLParse() function, but &nsbp; & and no doubt a few other similar codes are being rejected by the parser. How do i go about accepting these values? I can not remove them from the source since some some third party tool is generating the xhtml input.

Many thanks :)
LVL 1
paddycobbettAsked:
Who is Participating?
 
SidFishesConnect With a Mentor Commented:
nope...xml does not allow & outside of CDATA

what you can do is this

<cfsavecontent variable="vTest">
<cfsavecontent v
<html>
<head></head>
<body>
blah blah &nsbp; blah
</body>
</html>
</cfsavecontent>

<cfset vTest = replace(vTest, "&nbsp;", "", "all">
<cfset vTest = replace(vTest, "&amp;","and", "all">
etc

then parse your xml based on #vTest# which should be clean




0
 
SidFishesCommented:
try something like

<cfset vTest = "&nbsp">

<mynode><![CDATA[#vTest#]]></mynode>
0
 
paddycobbettAuthor Commented:
Thanks SidFishes, one issue as i pointed out is that the xhtml code is being generated by a third party tool (output from the FCKeditor infact), so can not easily insert "<![CDATA" in to each node. The truth is i could strip out these values befoe parsing, but was wondering is there is a way so that these values can be accepted by the xml.

Something as simple as the attached can not be parsed via XMLParse for example.
<html>
<head></head>
<body>
blah blah &nsbp; blah
</body>
</html>

Open in new window

0
All Courses

From novice to tech pro — start learning today.