Details
Assignee
Robert CooperRobert CooperReporter
Robert CooperRobert CooperPriority
Major
Details
Details
Assignee
Robert Cooper
Robert CooperReporter
Robert Cooper
Robert CooperPriority
Created April 1, 2011 at 8:06 PM
Updated April 1, 2011 at 8:06 PM
I am using rome 1.0, georss rome 0.9.8 and jdom 1.0.
I ran into an issue when trying to parse the feed at:
http://www.inciweb.org/feeds/rss/incidents/.
A few item elements in this feed contains invalid GeoRSS elements such
as <georssoint>
</georssoint><geo:lat></geo:lat><geo:long></geo:long>. Parsing
this feed using the following code found at
http://georss.geonames.org/:
SyndFeed feed = input.build(new XmlReader(new URL(
"http://www.inciweb.org/feeds/rss/incidents/")));
List<SyndEntry> entries = feed.getEntries();
for (SyndEntry entry : entries) {
GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS(entry);
if (geoRSSModule != null && geoRSSModule.getPosition() != null
&& entry.getDescription() != null) {
System.out.println(entry.getTitle() + " : lat="
+ geoRSSModule.getPosition().getLatitude() +
",lng="
+ geoRSSModule.getPosition().getLongitude() +
", desc="
+ entry.getDescription().getValue() + "; time="
+ entry.getPublishedDate());
}
}
fails due to a NumberFormatException at
com.sun.syndication.feed.module.georss.SimpleParser.parseSimple(SimpleP
arser.java:80). Line 80 in SimpleParser.java contains the following:
Position pos = new Position(Double.parseDouble(coord[0]),
Double.parseDouble(coord[1]));
I would like to still be able to retrieve the RSS items that contains
valid tags, but because of this exception, parsing of the feed is
interrupted. What would be the best fix for this issue? Should the
NumberFormatException be caught and ignored in SimpleParser.java?
Thank you.