Fixed startElement method in SyndHandler
This commit is contained in:
parent
06688a139a
commit
dc3ae95a89
|
@ -20,6 +20,7 @@ public class FeedHandler {
|
||||||
RSSHandler handler = new RSSHandler(feed);
|
RSSHandler handler = new RSSHandler(feed);
|
||||||
try {
|
try {
|
||||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
|
factory.setNamespaceAware(true);
|
||||||
SAXParser saxParser = factory.newSAXParser();
|
SAXParser saxParser = factory.newSAXParser();
|
||||||
saxParser.parse(new File(feed.getFile_url()), handler);
|
saxParser.parse(new File(feed.getFile_url()), handler);
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
|
|
|
@ -25,7 +25,11 @@ public abstract class SyndHandler extends DefaultHandler{
|
||||||
state.tagstack.push(qName);
|
state.tagstack.push(qName);
|
||||||
|
|
||||||
String[] parts = qName.split(":");
|
String[] parts = qName.split(":");
|
||||||
Namespace handler = state.namespaces.get(parts[0]);
|
String prefix = "";
|
||||||
|
if (parts.length >= 2) {
|
||||||
|
prefix = parts[0];
|
||||||
|
}
|
||||||
|
Namespace handler = state.namespaces.get(prefix);
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.handleElement(localName, state, attributes);
|
handler.handleElement(localName, state, attributes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue