1 17 package com.sun.syndication.io.impl; 18 19 import org.jdom.Document; 20 import org.jdom.Element; 21 import org.jdom.Namespace; 22 import com.sun.syndication.feed.WireFeed; 23 24 25 37 public class RSS20wNSParser extends RSS20Parser { 38 private static String RSS20_URI = "http://backend.userland.com/rss2"; 39 40 public RSS20wNSParser() { 41 this("rss_2.0wNS"); 42 } 43 44 protected RSS20wNSParser(String type) { 45 super(type); 46 } 47 48 public boolean isMyType(Document document) { 49 Element rssRoot = document.getRootElement(); 50 Namespace defaultNS = rssRoot.getNamespace(); 51 boolean ok = defaultNS!=null && defaultNS.equals(getRSSNamespace()); 52 if (ok) { 53 ok = super.isMyType(document); 54 } 55 return ok; 56 } 57 58 protected Namespace getRSSNamespace() { 59 return Namespace.getNamespace(RSS20_URI); 60 } 61 62 67 protected WireFeed parseChannel(Element rssRoot) { 68 WireFeed wFeed = super.parseChannel(rssRoot); 69 wFeed.setFeedType("rss_2.0"); 70 return wFeed; 71 } 72 73 } 74 | Popular Tags |