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,28 +77,31 @@ public class SyndHandler extends DefaultHandler {
public void startPrefixMapping(String prefix, String uri)
throws SAXException {
// Find the right namespace
if (uri.equals(NSAtom.NSURI)) {
if (prefix.equals(DEFAULT_PREFIX)) {
state.defaultNamespaces.push(new NSAtom());
} else if (prefix.equals(NSAtom.NSTAG)) {
state.namespaces.put(uri, new NSAtom());
if (!state.namespaces.containsKey(uri)) {
if (uri.equals(NSAtom.NSURI)) {
if (prefix.equals(DEFAULT_PREFIX)) {
state.defaultNamespaces.push(new NSAtom());
} else if (prefix.equals(NSAtom.NSTAG)) {
state.namespaces.put(uri, new NSAtom());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized Atom namespace");
}
} else if (uri.equals(NSContent.NSURI)
&& prefix.equals(NSContent.NSTAG)) {
state.namespaces.put(uri, new NSContent());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized Atom namespace");
Log.d(TAG, "Recognized Content namespace");
} else if (uri.equals(NSITunes.NSURI)
&& prefix.equals(NSITunes.NSTAG)) {
state.namespaces.put(uri, new NSITunes());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized ITunes namespace");
} else if (uri.equals(NSSimpleChapters.NSURI)
&& prefix.equals(NSSimpleChapters.NSTAG)) {
state.namespaces.put(uri, new NSSimpleChapters());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized SimpleChapters namespace");
}
} else if (uri.equals(NSContent.NSURI)
&& prefix.equals(NSContent.NSTAG)) {
state.namespaces.put(uri, new NSContent());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized Content namespace");
} else if (uri.equals(NSITunes.NSURI) && prefix.equals(NSITunes.NSTAG)) {
state.namespaces.put(uri, new NSITunes());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized ITunes namespace");
} else if (uri.equals(NSSimpleChapters.NSURI)
&& prefix.equals(NSSimpleChapters.NSTAG)) {
state.namespaces.put(uri, new NSSimpleChapters());
if (AppConfig.DEBUG)
Log.d(TAG, "Recognized SimpleChapters namespace");
}
}