Package net.i2p.router.news
Class NewsXMLParser
- java.lang.Object
- 
- net.i2p.router.news.NewsXMLParser
 
- 
 public class NewsXMLParser extends Object Parse out the news.xml file which is in Atom format (RFC4287). We use the XML parser from the UPnP library.- Since:
- 0.9.17
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classNewsXMLParser.XHTMLModeThe action taken when encountering a non-whitelisted XHTML element or blacklisted attribute in the feed content.
 - 
Constructor SummaryConstructors Constructor Description NewsXMLParser(I2PAppContext ctx)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BlocklistEntriesgetBlocklistEntries()The blocklist entries.List<CRLEntry>getCRLEntries()The news CRL entries.List<NewsEntry>getEntries()The news entries.NewsMetadatagetMetadata()The news metatdata.static List<Node>getNodes(Node node, String name)Helper to get all Nodes matching the namestatic voidmain(String[] args)Nodeparse(File file)Process the XML file.Nodeparse(InputStream in)Process the XML input stream.voidsetXHTMLMode(NewsXMLParser.XHTMLMode mode)Sets the action taken when encountering a non-whitelisted XHTML element in the feed content.
 
- 
- 
- 
Constructor Detail- 
NewsXMLParserpublic NewsXMLParser(I2PAppContext ctx) 
 
- 
 - 
Method Detail- 
setXHTMLModepublic void setXHTMLMode(NewsXMLParser.XHTMLMode mode) Sets the action taken when encountering a non-whitelisted XHTML element in the feed content. Must be set before parse(). Default REMOVE_ELEMENT.
 - 
parsepublic Node parse(File file) throws IOException Process the XML file.- Parameters:
- file- XML content only. Any su3 or gunzip handling must have already happened.
- Returns:
- the root node
- Throws:
- IOException- on any parse error
 
 - 
parsepublic Node parse(InputStream in) throws IOException Process the XML input stream.- Parameters:
- in- XML content only. Any su3 or gunzip handling must have already happened.
- Returns:
- the root node
- Throws:
- IOException- on any parse error
 
 - 
getEntriespublic List<NewsEntry> getEntries() The news entries. Must call parse() first.- Returns:
- sorted, newest first, null if parse failed
 
 - 
getMetadatapublic NewsMetadata getMetadata() The news metatdata. Must call parse() first.- Returns:
- null if parse failed
 
 - 
getCRLEntriespublic List<CRLEntry> getCRLEntries() The news CRL entries. Must call parse() first.- Returns:
- unsorted, null if none
- Since:
- 0.9.26
 
 - 
getBlocklistEntriespublic BlocklistEntries getBlocklistEntries() The blocklist entries. Must call parse() first.- Returns:
- null if none
- Since:
- 0.9.28
 
 - 
getNodespublic static List<Node> getNodes(Node node, String name) Helper to get all Nodes matching the name- Returns:
- non-null
 
 - 
mainpublic static void main(String[] args) 
 
- 
 
-