Changed return type of handleElementStart

This commit is contained in:
daniel oeh 2012-06-10 11:02:40 +02:00
parent 4166e04a3f
commit d397ef0df7
4 changed files with 9 additions and 7 deletions

View File

@ -32,8 +32,8 @@ public class SyndHandler extends DefaultHandler {
Namespace handler = getHandlingNamespace(uri); Namespace handler = getHandlingNamespace(uri);
if (handler != null) { if (handler != null) {
handler.handleElementStart(localName, state, attributes); SyndElement element = handler.handleElementStart(localName, state, attributes);
state.tagstack.push(new SyndElement(localName, handler)); state.tagstack.push(element);
} }
} }
@ -46,7 +46,6 @@ public class SyndHandler extends DefaultHandler {
if (top.getNamespace() != null) { if (top.getNamespace() != null) {
top.getNamespace().handleCharacters(state, ch, start, length); top.getNamespace().handleCharacters(state, ch, start, length);
} }
// ignore element otherwise
} }
@Override @Override

View File

@ -11,9 +11,9 @@ public abstract class Namespace {
public static final String NSURI = null; public static final String NSURI = null;
/** Called by a Feedhandler when in startElement and it detects a namespace element /** 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 */ /** 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); public abstract void handleCharacters(HandlerState state, char ch[], int start, int length);

View File

@ -5,6 +5,7 @@ import org.xml.sax.Attributes;
import de.podfetcher.feed.Feed; import de.podfetcher.feed.Feed;
import de.podfetcher.syndication.handler.HandlerState; import de.podfetcher.syndication.handler.HandlerState;
import de.podfetcher.syndication.namespace.Namespace; import de.podfetcher.syndication.namespace.Namespace;
import de.podfetcher.syndication.namespace.SyndElement;
public class NSAtom extends Namespace { public class NSAtom extends Namespace {
public static final String NSTAG = "atom"; public static final String NSTAG = "atom";
@ -16,11 +17,12 @@ public class NSAtom extends Namespace {
private static final String AUTHOR = "author"; private static final String AUTHOR = "author";
@Override @Override
public void handleElementStart(String localName, HandlerState state, public SyndElement handleElementStart(String localName, HandlerState state,
Attributes attributes) { Attributes attributes) {
if (localName.equals(TITLE)) { if (localName.equals(TITLE)) {
} }
return null;
} }
@Override @Override

View File

@ -40,7 +40,7 @@ public class NSRSS20 extends Namespace {
public final static String ENC_TYPE = "type"; public final static String ENC_TYPE = "type";
@Override @Override
public void handleElementStart(String localName, HandlerState state, public SyndElement handleElementStart(String localName, HandlerState state,
Attributes attributes) { Attributes attributes) {
if (localName.equals(ITEM)) { if (localName.equals(ITEM)) {
state.setCurrentItem(new FeedItem()); state.setCurrentItem(new FeedItem());
@ -55,6 +55,7 @@ public class NSRSS20 extends Namespace {
} else if (localName.equals(IMAGE)) { } else if (localName.equals(IMAGE)) {
state.getFeed().setImage(new FeedImage()); state.getFeed().setImage(new FeedImage());
} }
return new SyndElement(localName, this);
} }
@Override @Override