id and guid is now read by feedparser

This commit is contained in:
daniel oeh 2012-07-31 19:58:22 +02:00
parent bc2eae53a8
commit 4d48cab60f
2 changed files with 13 additions and 5 deletions

View File

@ -20,6 +20,7 @@ public class NSAtom extends Namespace {
public static final String NSURI = "http://www.w3.org/2005/Atom";
private static final String FEED = "feed";
private static final String ID = "id";
private static final String TITLE = "title";
private static final String ENTRY = "entry";
private static final String LINK = "link";
@ -50,7 +51,7 @@ public class NSAtom extends Namespace {
public static final String isFeed = FEED + "|" + NSRSS20.CHANNEL;
public static final String isFeedItem = ENTRY + "|" + NSRSS20.ITEM;
@Override
public SyndElement handleElementStart(String localName, HandlerState state,
Attributes attributes) {
@ -93,7 +94,6 @@ public class NSAtom extends Namespace {
return new SyndElement(localName, this);
}
@Override
public void handleElementEnd(String localName, HandlerState state) {
if (localName.equals(ENTRY)) {
@ -113,7 +113,11 @@ public class NSAtom extends Namespace {
textElement.setContent(content);
}
if (top.equals(TITLE)) {
if (top.equals(ID)) {
if (second.equals(ENTRY)) {
state.getCurrentItem().setItemIdentifier(content);
}
} else if (top.equals(TITLE)) {
if (second.equals(FEED)) {
state.getFeed().setTitle(textElement.getProcessedContent());

View File

@ -29,6 +29,7 @@ public class NSRSS20 extends Namespace {
public final static String CHANNEL = "channel";
public final static String ITEM = "item";
public final static String GUID = "guid";
public final static String TITLE = "title";
public final static String LINK = "link";
public final static String DESCR = "description";
@ -80,7 +81,10 @@ public class NSRSS20 extends Namespace {
String top = topElement.getName();
SyndElement secondElement = state.getSecondTag();
String second = secondElement.getName();
if (top.equals(TITLE)) {
if (top.equals(GUID) && second.equals(ITEM)) {
state.getCurrentItem().setItemIdentifier(content);
} else if (top.equals(TITLE)) {
if (second.equals(ITEM)) {
state.getCurrentItem().setTitle(content);
} else if (second.equals(CHANNEL)) {
@ -102,7 +106,7 @@ public class NSRSS20 extends Namespace {
} else if (localName.equals(DESCR)) {
if (second.equals(CHANNEL)) {
state.getFeed().setDescription(content);
} else if (second.equals(ITEM)){
} else if (second.equals(ITEM)) {
state.getCurrentItem().setDescription(content);
}