user477768
user477768

Reputation:

Escape many tags at the same time in XML

I have XML tag that has the content which is HTML document.

<xml-tag>
    <!--
        <p>html document goes here</p>
        <p><span id="important">important html</span></p>
    -->
</xml-tag>

Now, Is there anyway to escape the whole html document inside the body of <xml-tag>? If I don't escape the content, the XML document will not be well-formed and I will have no way to retrieve the data I need. In C#, for example, If I want to escape the whole string, I can put the @ symbol in front of the string, is there anyway to do that in XML?

Upvotes: 0

Views: 112

Answers (1)

BluesRockAddict
BluesRockAddict

Reputation: 15683

You can wrap the whole HTML part in CDATA:

<xml-tag>
    <![CDATA[
        <p>html document goes here</p>
        <p><span id="important">important html</span></p>
    ]]
</xml-tag>

See more information on using CDATA here: http://www.w3schools.com/xml/xml_cdata.asp

Upvotes: 1

Related Questions