public class NewsXMLParser extends Object
Processes news.xml files following RFC4287 Atom specification using the UPnP XML parser library with enhanced security features. Handles news entries, metadata, CRL entries, and blocklist data with configurable XHTML filtering.
Provides comprehensive validation and sanitization of news content with support for multiple content types and security levels. Includes configurable handling of potentially dangerous XHTML elements and attributes.
| Modifier and Type | Class and Description |
|---|---|
static class |
NewsXMLParser.XHTMLMode
The action taken when encountering a non-whitelisted
XHTML element or blacklisted attribute in the feed content.
|
| Constructor and Description |
|---|
NewsXMLParser(I2PAppContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
BlocklistEntries |
getBlocklistEntries()
The blocklist entries.
|
List<CRLEntry> |
getCRLEntries()
The news CRL entries.
|
List<NewsEntry> |
getEntries()
The news entries.
|
NewsMetadata |
getMetadata()
The news metatdata.
|
static List<Node> |
getNodes(Node node,
String name)
Helper to get all Nodes matching the name
|
static void |
main(String[] args) |
Node |
parse(File file)
Process the XML file.
|
Node |
parse(InputStream in)
Process the XML input stream.
|
void |
setXHTMLMode(NewsXMLParser.XHTMLMode mode)
Sets the action taken when encountering a non-whitelisted
XHTML element in the feed content.
|
public NewsXMLParser(I2PAppContext ctx)
public BlocklistEntries getBlocklistEntries()
public List<CRLEntry> getCRLEntries()
public List<NewsEntry> getEntries()
public NewsMetadata getMetadata()
public static List<Node> getNodes(Node node, String name)
public static void main(String[] args)
public Node parse(File file) throws IOException
file - XML content only. Any su3 or gunzip handling must have
already happened.IOException - on any parse errorpublic Node parse(InputStream in) throws IOException
in - XML content only. Any su3 or gunzip handling must have
already happened.IOException - on any parse errorpublic void setXHTMLMode(NewsXMLParser.XHTMLMode mode)