diff --git a/src/de/podfetcher/syndication/handler/SyndHandler.java b/src/de/podfetcher/syndication/handler/SyndHandler.java index 3f9d93eed..949690af4 100644 --- a/src/de/podfetcher/syndication/handler/SyndHandler.java +++ b/src/de/podfetcher/syndication/handler/SyndHandler.java @@ -32,8 +32,8 @@ public class SyndHandler extends DefaultHandler { Namespace handler = getHandlingNamespace(uri); if (handler != null) { - handler.handleElementStart(localName, state, attributes); - state.tagstack.push(new SyndElement(localName, handler)); + SyndElement element = handler.handleElementStart(localName, state, attributes); + state.tagstack.push(element); } } @@ -46,7 +46,6 @@ public class SyndHandler extends DefaultHandler { if (top.getNamespace() != null) { top.getNamespace().handleCharacters(state, ch, start, length); } - // ignore element otherwise } @Override diff --git a/src/de/podfetcher/syndication/namespace/Namespace.java b/src/de/podfetcher/syndication/namespace/Namespace.java index 4101b0118..6142c9590 100644 --- a/src/de/podfetcher/syndication/namespace/Namespace.java +++ b/src/de/podfetcher/syndication/namespace/Namespace.java @@ -11,9 +11,9 @@ public abstract class Namespace { public static final String NSURI = null; /** Called by a Feedhandler when in startElement and it detects a namespace element - * @return true if namespace handled the element, false if it ignored it + * @return The SyndElement to push onto the stack * */ - public abstract void handleElementStart(String localName, HandlerState state, Attributes attributes); + public abstract SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes); /** Called by a Feedhandler when in characters and it detects a namespace element */ public abstract void handleCharacters(HandlerState state, char ch[], int start, int length); diff --git a/src/de/podfetcher/syndication/namespace/atom/NSAtom.java b/src/de/podfetcher/syndication/namespace/atom/NSAtom.java index 7ca23572e..7406e77d0 100644 --- a/src/de/podfetcher/syndication/namespace/atom/NSAtom.java +++ b/src/de/podfetcher/syndication/namespace/atom/NSAtom.java @@ -5,6 +5,7 @@ import org.xml.sax.Attributes; import de.podfetcher.feed.Feed; import de.podfetcher.syndication.handler.HandlerState; import de.podfetcher.syndication.namespace.Namespace; +import de.podfetcher.syndication.namespace.SyndElement; public class NSAtom extends Namespace { public static final String NSTAG = "atom"; @@ -16,11 +17,12 @@ public class NSAtom extends Namespace { private static final String AUTHOR = "author"; @Override - public void handleElementStart(String localName, HandlerState state, + public SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes) { if (localName.equals(TITLE)) { } + return null; } @Override diff --git a/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java b/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java index c536d216c..592a96d66 100644 --- a/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java +++ b/src/de/podfetcher/syndication/namespace/rss20/NSRSS20.java @@ -40,7 +40,7 @@ public class NSRSS20 extends Namespace { public final static String ENC_TYPE = "type"; @Override - public void handleElementStart(String localName, HandlerState state, + public SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes) { if (localName.equals(ITEM)) { state.setCurrentItem(new FeedItem()); @@ -55,6 +55,7 @@ public class NSRSS20 extends Namespace { } else if (localName.equals(IMAGE)) { state.getFeed().setImage(new FeedImage()); } + return new SyndElement(localName, this); } @Override