简体   繁体   中英

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

在此输入图像描述

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

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM