Escaping HTML characters to XML
Posted on 2003-10-29
I have some XHTML code, which I want to include as a node-with-subnodes into an XML file.
xhtml to be included in "description"
<p>this<b>something bold</b>is to be included</p>
and the result would be:
is to be included
I am using ASP with Msxml2.DOMDocument.3.0
- - - -
The inserted XHTML comes from an ActiveX in a webform, which produces XHTML.
Everything goes well, untill there are some HTML encoded characters like ë (é) or €
Then i can not transform the XHTML to a DOM document.
I have been working to escape the HTML encoded characters to XML encoding, replacing "ë" with "ë". Then everything works again. This however takes a simple but long function, in which i have to replace ALL possible HTML-encoded characters with their XML-equivalent.
I wonder if their is an easier way to do it.
Any suggestion is welcome.