I am trying to get text from an xml file that looks like so:
<description>
<p>
<strong>Last updated:</strong>
Mon, 19 Aug 2013 23:52:31</p>
<p>Incident is 53% contained.</p>
<![CDATA[<p>The American Fire burning in heavy fuels on extreme slopes about 10 air miles northeast of the community of Foresthill, California, and eight air miles south of Interstate 80 has grown to 14,765 acres.</p> <p><strong>The public is invited to an American Fire update meeting at the Foresthill Veteran's Memorial Hall at 24601 Harrison Street in Foresthill beginning at 7 p.m. tonight.</strong></p> <p>Heavy smoke shaded the fire yesterday, moderating fire behavior. Backing fire with single and group tree torching was observed. On the northeast corner a spot fire was quickly contained by firefighters as they made good progress with hand lines and dozer lines. Along the eastern portion of the fire last night, firefighters conducted a firing operation, meaning they used fire to reduce unburned fuel between the fire line and the main fire. The center portion of the east flank was still very active during the day, but indirect containment lines remained secure. On the extreme south end, firefighters will begin building a very steep hand line today, which descends to the river. The west side of the fire was relatively inactive. Mop-up is occurring in this area, which involves checking the interior of the fire to ensure no hot spots remain that may threaten the containment lines.</p> <p>Firefighters continue to be concerned about dry fuels that have not seen fire in over a century, as well as any winds over 5 m.p.h. and rolling burning debris, all of which could cause a rapid spread of the fire.</p> <p>The National Weather Service has issued a Red Flag Warning for the fire area beginning at 11 a.m. today and extending through 11 p.m. Wednesday. This Warning is due to the threat of abundant lightning and gusty, erratic outflow winds. Significant rainfall and flooding in and around the fire is also possible over the next three days.</p> <p>The Robinson Flat Campground is closed. The Tahoe National Forest has issued a voluntary evacuation notice for Big Oak Flat located near the south end of the fire. Forest Road 43 (Robinson Flat Road) is closed at its intersection with Forest Road 96 (Mosquito Ridge Road).</p> <p>An emergency closure order is in place for portions of National Forest System lands within and adjacent to the American Fire. A map and description of the closed area can be obtained at Tahoe National Forest offices as well as online at <a href="http://www.fs.usda.gov/tahoe">http://www.fs.usda.gov/tahoe</a>. Portions of the Foresthill Divide road are closed.</p> <p><strong>At 6 a.m. today, management of the fire was transferred to the California Interagency Management Team 4.</strong></p> <p>Firefighter and public safety are the highest priority.</p>]]>
<p>
<a href="http://inciweb.nwcg.gov/incident/3624/">View American Wildfire web site</a>
</p>
<p>
<strong>NOTE: </strong>
All fire perimeters and points are approximations.</p>
</description>
When I parse it, I can get all the information within the CDATA area, but the rest of it is ignored. I am parsing and putting into my text view like so:
description.setText(extras.getString("desc"));
I am using android query and can have it format no problem with this:
aq.id(R.id.description).text(Html.fromHtml(extras.getString("desc")));
However, same issue, just getting the cdata info. My log.v() shows just the info between cdata. So I guess I need to escape it somehow? Why is the text outside of cdata being ignored?
Thanks Thanks
I was able to get rid of cdata this way:
for (XmlDom entry : entries) {
XmlDom description = entry.tag("description");
String cdatareplace = description.toString();
String desc = cdatareplace.replace("<![CDATA[", "");
desc = desc.replace("]]>", "");
kmllist.add(new KML(entry.text("name"), desc));
}
Add the entry tag to the variable then use string replace to get rid of the cdata and then show all of the text within the tags. Works fine.