java.lang.Object
org.cybergarage.xml.Parser
org.cybergarage.xml.parser.JaxpParser
net.i2p.router.news.XMLParser
Enhanced XML parser for I2P news content with XHTML support.
Extends the base JaxpParser to properly handle mixed text and subnodes in XHTML content while maintaining both output types. Overrides default parsing behavior to ensure correct handling of text nodes and element separation.
Provides custom output methods that recognize special text nodes and uses empty entities for self-closing tags to prevent malformed HTML output.
Field Summary
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprivate static voidoutput(StringBuilder buf, Node node, int indentLevel) A replacement forNode.output(PrintWriter, int, boolean), which does not recognize #text.Modified from UPnP JaxpParser.static voidtoString(StringBuilder buf, Node node) A replacement forNode.toString(String, boolean), which does not recognize #text.Methods inherited from class JaxpParser
parse, parse
Field Details
WHITESPACE
Matches spaces, tabs and line breaks_log
Logger for this class.TEXT_NAME
DOM node name the parser uses for character data.- See Also:
Constructor Details
XMLParser
Creates a parser that logs under its own class.- Parameters:
ctx- the context supplying the log manager for this parser
Method Details
parse
Modified from UPnP JaxpParser.- Overrides:
parsein classJaxpParser- Parameters:
parentNode- null if at topdomNode- the DOM node to parserank- parse level, only for debug- Returns:
- the parsed node, or the parent node, unused except at top level
toString
A replacement forNode.toString(String, boolean), which does not recognize #text.- Parameters:
buf- the buffer receiving the XML text of the node and its childrennode- the root of the subtree to render
output
A replacement forNode.output(PrintWriter, int, boolean), which does not recognize #text. Also, we use the empty entity, so <br /> does not turn into <br></br>.- Parameters:
buf- the buffer receiving the rendered XML of the node and its childrennode- the root of the subtree to renderindentLevel- the nesting depth of this node, incremented per child level, currently not rendered