0

I have this tag in my xml :

<description><![CDATA[<div><b>Location:</b> PUMBA Auditorium - University of Pune</div>
<div><b>Start Time:</b> 5/15/2012 11:00 AM</div>
<div><b>End Time:</b> 5/15/2012 2:00 PM</div>
<div><b>Description:</b> <div>General B. C. Joshi Memorial Lecture 2012- Perspective on War in the 21st Century - By Lt. Gen. A. K. Singh</div></div>
<div><b>Attachments:</b> <a href="http://uopnews.unipune.ac.in/Lists/Calendar/Attachments/14/bcjoshi2012[1].pdf">http://uopnews.unipune.ac.in/Lists/Calendar/Attachments/14/bcjoshi2012[1].pdf</a><br><a href=""></a></div>
]]></description>

I need to remove "<div><b>" n want to show only content. what should i need to do for this.? Please help me. Thanks in advance.

Neha
  • 245
  • 5
  • 17
  • see if this helps you: http://stackoverflow.com/questions/9244345/using-saxparser-to-get-info-to-more-than-one-element-android – amp May 19 '12 at 19:02
  • I have already tried the above link but its giving me only this output:
    Location: PUMBA Auditorium - University of Pune
    the output i want is: PUMBA Auditorium - University of Pune Start Time:5/15/2012 11:00 AM End Time:5/15/2012 2:00 PM Description:General B. C. Joshi Memorial Lecture 2012- Perspective on War in the 21st Century - By Lt. Gen. A. K. Singh Attachments:http://uopnews.unipune.ac.in/Lists/Calendar/Attachments/14/bcjoshi2012[1].pdf. Is there any way to obtain this type of output?
    – Neha May 20 '12 at 13:53

1 Answers1

0

You basically have to parse again. Everything contained between <![CDATA[ and ]]> is treated as character data (text) by the parser. Assuming that this text is valid xhtml, you can convert the string to a ByteArrayInputStream and feed it to the parser.

Android also provides the Html class with the Html.fromHtml(String) method which receives a string and returns a new string without Html tags and accordingly formatted, so you can just feed your sax-parsed string to that.

BaiKin
  • 3
  • 1
forty-two
  • 12,204
  • 2
  • 26
  • 36