ReNa
ReNa

Reputation: 1124

How to parse xml having html tags within xml tags

I've got an xml which has html within the xml tags and i'm not able to parse as it.

When i start parsing the xml the str tag has html in it

enter image description here

can anyone help me out in extracting the html with all the tags.

Upvotes: 1

Views: 1670

Answers (2)

Kevin Ji
Kevin Ji

Reputation: 10489

It is a good idea to store XHTML within CDATA tags (<![CDATA[ and ]]>), so that it can be retrieved normally:

<str name="body">
      <![CDATA[<font face="arial" size="2"><ul><li><p align="justify">india’s first</p></li></ul></font>]]>
</str>

Upvotes: 3

helloworld
helloworld

Reputation: 2311

Problem is not the HTML but improper HTML. If this HTML is in your hand, ensure it complies with XHTML and xml parser will treat it as normal xml. However, you may otherwise use tools like "HTML Tidy" ti fix your HTML and use HTML parsers. For example: http://www.codeproject.com/KB/dotnet/apmilhtml.aspx

Upvotes: 0

Related Questions