dotnet_Profiler dotnet_Profiler - 5 months ago 35
HTML Question

Deserialize XML with HTML Tags

I'm wondering for a solution to deserialise the values of HTML in a XML Element.
My Sample XML is given below,

<root>
<Element>
<P>This <i>is </i> a sample <B>XML Tag</B><P>
</Element>
<root>


I want this "

This is a sample XML Tag

" as string. Please suggest me the solution. I cannot add cdata in the XML file.

Answer

You need to use escape characters:

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

Full reference:

http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

Comments