1

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.

5
  • 1
    What language are you using to parse the XML? PHP, JavaScript, ...? Commented Apr 21, 2011 at 5:03
  • Please show what you tried. Also, paste the actual XML, not an image of it. I can't read that at all. Commented Apr 21, 2011 at 5:07
  • Also, Rahul, please don't put "Hi" in your questions, and don't use a signature, thanks, or "any help appreciated". This is not a discussion forum, so that sort of "conversational" language is not necessary and in fact is just noise. Commented Apr 21, 2011 at 5:10
  • Can you please link to an image that doesn't have all of the XML highlighted, please? Commented Apr 21, 2011 at 5:31
  • @mc10 i''ve changed the image Commented Apr 21, 2011 at 5:47

2 Answers 2

3

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>
Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.