Prevented namespace URIs from being added more than once

This commit is contained in:
daniel oeh 2012-09-01 13:27:41 +02:00
parent 21fd53c8bd
commit ce0d14db42
1 changed files with 23 additions and 20 deletions

View File

@ -77,6 +77,7 @@ public class SyndHandler extends DefaultHandler {
public void startPrefixMapping(String prefix, String uri) public void startPrefixMapping(String prefix, String uri)
throws SAXException { throws SAXException {
// Find the right namespace // Find the right namespace
if (!state.namespaces.containsKey(uri)) {
if (uri.equals(NSAtom.NSURI)) { if (uri.equals(NSAtom.NSURI)) {
if (prefix.equals(DEFAULT_PREFIX)) { if (prefix.equals(DEFAULT_PREFIX)) {
state.defaultNamespaces.push(new NSAtom()); state.defaultNamespaces.push(new NSAtom());
@ -90,7 +91,8 @@ public class SyndHandler extends DefaultHandler {
state.namespaces.put(uri, new NSContent()); state.namespaces.put(uri, new NSContent());
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Recognized Content namespace"); Log.d(TAG, "Recognized Content namespace");
} else if (uri.equals(NSITunes.NSURI) && prefix.equals(NSITunes.NSTAG)) { } else if (uri.equals(NSITunes.NSURI)
&& prefix.equals(NSITunes.NSTAG)) {
state.namespaces.put(uri, new NSITunes()); state.namespaces.put(uri, new NSITunes());
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Recognized ITunes namespace"); Log.d(TAG, "Recognized ITunes namespace");
@ -101,6 +103,7 @@ public class SyndHandler extends DefaultHandler {
Log.d(TAG, "Recognized SimpleChapters namespace"); Log.d(TAG, "Recognized SimpleChapters namespace");
} }
} }
}
private Namespace getHandlingNamespace(String uri) { private Namespace getHandlingNamespace(String uri) {
Namespace handler = state.namespaces.get(uri); Namespace handler = state.namespaces.get(uri);