mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-28 17:39:24 +01:00
Merged SyndElement with NSElement
This commit is contained in:
parent
7f978fde78
commit
b19afaa82c
@ -25,12 +25,8 @@ public abstract class SyndHandler extends DefaultHandler{
|
|||||||
Attributes attributes) throws SAXException {
|
Attributes attributes) throws SAXException {
|
||||||
state.tagstack.push(new SyndElement(qName));
|
state.tagstack.push(new SyndElement(qName));
|
||||||
|
|
||||||
String[] parts = qName.split(":");
|
|
||||||
String prefix = "";
|
Namespace handler = state.namespaces.get(uri);
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -48,7 +44,7 @@ public abstract class SyndHandler extends DefaultHandler{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endPrefixMapping(String prefix) throws SAXException {
|
public void endPrefixMapping(String prefix) throws SAXException {
|
||||||
state.namespaces.remove(prefix);
|
// TODO remove Namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +55,7 @@ public abstract class SyndHandler extends DefaultHandler{
|
|||||||
Log.d(TAG, "Found Prefix Mapping with prefix " + prefix + " and uri " + uri);
|
Log.d(TAG, "Found Prefix Mapping with prefix " + prefix + " and uri " + uri);
|
||||||
// Find the right namespace
|
// Find the right namespace
|
||||||
if (prefix.equals(NSAtom.NSTAG) || uri.equals(NSAtom.NSURI)) {
|
if (prefix.equals(NSAtom.NSTAG) || uri.equals(NSAtom.NSURI)) {
|
||||||
state.namespaces.put(prefix, new NSAtom());
|
state.namespaces.put(uri, new NSAtom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package de.podfetcher.syndication.namespace;
|
|
||||||
|
|
||||||
import org.xml.sax.Attributes;
|
|
||||||
|
|
||||||
import de.podfetcher.feed.Feed;
|
|
||||||
import de.podfetcher.syndication.handler.HandlerState;
|
|
||||||
|
|
||||||
/** Defines a XML Element of a specific namespace */
|
|
||||||
public abstract class NSElement extends SyndElement{
|
|
||||||
protected Namespace namespace;
|
|
||||||
|
|
||||||
public NSElement(String name, Namespace namespace) {
|
|
||||||
super(name);
|
|
||||||
this.namespace = namespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Called by its namespace if the processing of the element gets more complex */
|
|
||||||
public abstract void handleElement(String localName, HandlerState state, Attributes attributes);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Namespace getNamespace() {
|
|
||||||
return namespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,9 +3,9 @@ package de.podfetcher.syndication.namespace;
|
|||||||
/** Defines a XML Element that is pushed on the tagstack */
|
/** Defines a XML Element that is pushed on the tagstack */
|
||||||
public class SyndElement {
|
public class SyndElement {
|
||||||
protected String name;
|
protected String name;
|
||||||
|
protected Namespace namespace;
|
||||||
|
|
||||||
public SyndElement(String name) {
|
public SyndElement(String name, Namespace namespace) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user