I have an XML data like this
<?xml version="1.0" encoding="UTF-8"?>
<Result>
<Status>OK</Status>
<DisplayName>Az-Zahra Madressah</DisplayName>
<Announcements>
<Announcement>
<Id>46</Id>
<Title>AZM Dates</Title>
<Description>
<strong>December 21st, 28th; Winter Break</strong>
~ January 4th: Madressah and
<strong>Acadamy ResumesAZM</strong>
will provide snacks every first Sunday of the month.
</Description>
<Attachments />
</Announcement>
</Announcements>
<Resources>
<Resource>
<Id>26</Id>
<Title>Quran Competition Audio FIles</Title>
<Description>* Quran Memorization Surah Competition Audio Files
* Quran Competition Surahs List</Description>
<Attachments>broadcast_notes/26_Sura Ad duha 93.mp3,broadcast_notes/26_Ayatul Kursi 2-255,256,257.mp3,broadcast_notes/26_Sura Al Aala 87.mp3,broadcast_notes/26_Sura Al Fatiha Hamd 1.mp3,broadcast_notes/26_Sura Al Falaq 113.mp3,broadcast_notes/26_Sura Al Balad 90.mp3,broadcast_notes/26_Sura Al Asr 103.mp3,broadcast_notes/26_Sura Al Feel 105.mp3,broadcast_notes/26_Sura Al Qadr 97.mp3,broadcast_notes/26_Sura Al Maoon 107.mp3,broadcast_notes/26_Sura Al Jumua 62.mp3,broadcast_notes/26_Sura Al Kafiroon 109.mp3,broadcast_notes/26_Sura Al Kauthar 108.mp3,broadcast_notes/26_Sura Al Qariah 101.mp3,broadcast_notes/26_Sura At Teen 95.mp3,broadcast_notes/26_Sura At Tawheed 112.mp3,broadcast_notes/26_Sura At Takathur 102.mp3,broadcast_notes/26_Sura Asshams 91.mp3,broadcast_notes/26_Sura An Nasr 110.mp3,broadcast_notes/26_Sura An Naas 114.mp3,broadcast_notes/26_Sura AlInfitar 82.mp3,broadcast_notes/26_Sura Al Quraish 106.mp3,broadcast_notes/26_Surah AlInshirah 94.mp3,broadcast_notes/26_2014 Quran Competition Surahs (1).docx</Attachments>
</Resource>
<Resource>
<Id>16</Id>
<Title>AZM Calendar</Title>
<Description>Az Zahra Madressah 2014-15 Calendar</Description>
<Attachments>broadcast_notes/16_AZM CALENDAR 2014_2015.xlsx</Attachments>
</Resource>
<Resource>
<Id>30</Id>
<Title>Madresaah Schedule</Title>
<Description>Madressah and Academy Students 2014-15 Schedule</Description>
<Attachments>broadcast_notes/30_Madressah Schedule 2014-2015.xlsx</Attachments>
</Resource>
</Resources>
</Result>
note :
<Description>
<strong>December 21st, 28th; Winter Break</strong>
~ January 4th: Madressah and
<strong>Acadamy ResumesAZM</strong>
will provide snacks every first Sunday of the month.
</Description>
When I prase I only got the Text * ~ January 4th: Madressah and* but what I want is to get the Whole text including the html tag .i.e and text within it.
In short I want the Text
<strong>December 21st, 28th; Winter Break</strong>
~ January 4th: Madressah and
<strong>Acadamy ResumesAZM</strong>
will provide snacks every first Sunday of the month.
Here is my code how I m parsing the this
Log.e("Text Desc", parser.getValue(
eAnnoucements, "Description"));
here is my getValue() method
public String getValue(Element item, String str) {
NodeList n = item.getElementsByTagName(str);
return this.getElementValue(n.item(0));
}
here is my getElementValue() method
public final String getElementValue(Node elem) {
Node child;
if (elem != null) {
if (elem.hasChildNodes()) {
for (child = elem.getFirstChild(); child != null; child = child
.getNextSibling()) {
if (child.getNodeType() == Node.TEXT_NODE) {
return child.getNodeValue();
}
}
}
}
return "";
}
please help me
No comments:
Post a Comment