SyndHandler wasn't always selecting the correct namespace handler
This commit is contained in:
parent
8f37a19875
commit
7e97934764
|
@ -33,7 +33,7 @@ public class SyndHandler extends DefaultHandler {
|
|||
public void startElement(String uri, String localName, String qName,
|
||||
Attributes attributes) throws SAXException {
|
||||
state.contentBuf = new StringBuffer();
|
||||
Namespace handler = getHandlingNamespace(uri);
|
||||
Namespace handler = getHandlingNamespace(uri, qName);
|
||||
if (handler != null) {
|
||||
SyndElement element = handler.handleElementStart(localName, state,
|
||||
attributes);
|
||||
|
@ -58,7 +58,7 @@ public class SyndHandler extends DefaultHandler {
|
|||
@Override
|
||||
public void endElement(String uri, String localName, String qName)
|
||||
throws SAXException {
|
||||
Namespace handler = getHandlingNamespace(uri);
|
||||
Namespace handler = getHandlingNamespace(uri, qName);
|
||||
if (handler != null) {
|
||||
handler.handleElementEnd(localName, state);
|
||||
state.tagstack.pop();
|
||||
|
@ -107,9 +107,9 @@ public class SyndHandler extends DefaultHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private Namespace getHandlingNamespace(String uri) {
|
||||
private Namespace getHandlingNamespace(String uri, String qName) {
|
||||
Namespace handler = state.namespaces.get(uri);
|
||||
if (handler == null && !state.defaultNamespaces.empty()) {
|
||||
if (handler == null && !state.defaultNamespaces.empty() && !qName.contains(":")) {
|
||||
handler = state.defaultNamespaces.peek();
|
||||
}
|
||||
return handler;
|
||||
|
|
|
@ -24,6 +24,7 @@ public class FeedHandlerTest extends AndroidTestCase {
|
|||
private static final String FEEDS_DIR = "testfeeds";
|
||||
|
||||
private static final String[] urls = {
|
||||
"http://feeds.feedburner.com/buildanalyze",
|
||||
"http://www.blacksweetstories.com/feed/podcast/",
|
||||
"http://bitlove.org/ranzzeit/ranz/feed",
|
||||
"http://bitlove.org/importthis/mp3/feed",
|
||||
|
@ -451,6 +452,14 @@ public class FeedHandlerTest extends AndroidTestCase {
|
|||
Log.e(TAG, "Feed has invalid items");
|
||||
return false;
|
||||
}
|
||||
if (feed.getLink() == null) {
|
||||
Log.e(TAG, "Feed has no link");
|
||||
return false;
|
||||
}
|
||||
if (feed.getLink() != null && feed.getLink().length() == 0) {
|
||||
Log.e(TAG, "Feed has empty link");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -478,7 +487,7 @@ public class FeedHandlerTest extends AndroidTestCase {
|
|||
parseFeed(feed);
|
||||
feeds.remove(0);
|
||||
}
|
||||
|
||||
|
||||
Log.i(TAG, "RSS Test completed");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue