My IE XML parser is using property similar to
xmlObj.childNodes[0].text to get the value inside of my XML object it
is looping through. Now I place some HTML inside of XML tag but I am
unable to see any HTML retrieved as if it never was there. Please,
suggest me something other than converting <> to [] in my xml file.
Playing with escape/unescape did not help too.
Thanks to all.
A little more detail in your question (e.g. sample code) would be
helpful, but I think I can guess what your problem is.
Any tags in your XML document, whether or not you want them to, are
going to be interpreted as XML nodes (as an aside, it is actually
surprising that your XML document was successfully parsed if you are
using HTML inside of it).
So you have two options to make your HTML bits get interpreted as text
nodes rather than XML fragments:
Option 1: In your HTML fragments, replace all XML special characters
(e.g. "<", ">", """, and "&") with their corresponding XML entities
(e.g. "<", ">", """, and "&", respectively). So this:
<xmlNode>
<a href="
http://www.w3.org">W3C Website</a>
</xmlNode>
becomes this:
<xmlNode>
<a href="
http://www.w3.org">W3CWebsite</a>
</xmlNode>
Option 2: Encase your HTML fragments in CDATA sections, which direct the
XML parser to interpret them as literals rather than nodes. This is
most likely the best option for you. Using the same example, you would
end up with:
<xmlNode><![CDATA[
<a href="
http://www.w3.org">W3C Website</a>
]]></xmlNode>
A block of <![CDATA[...]]> can contain anything, except the literal
"]]>" which would obviously close the CDATA section.
Jeremy