public class JaxpParser extends Parser
This parser uses the Java API for XML Processing (JAXP) to parse XML documents. It includes security measures to prevent XXE (XML External Entity) attacks and handles null character filtering for compatibility.
Key features:
| Constructor and Description |
|---|
JaxpParser()
Creates a new JaxpParser instance.
|
| Modifier and Type | Method and Description |
|---|---|
Node |
parse(InputStream inStream)
Parses XML content from the specified input stream using JAXP.
|
Node |
parse(Node parentNode,
Node domNode)
Parses a DOM node and converts it to a Node tree.
|
Node |
parse(Node parentNode,
Node domNode,
int rank)
Recursively parses a DOM node and converts it to a Node tree.
|
public Node parse(InputStream inStream) throws ParserException
This method creates a secure DocumentBuilderFactory with XXE protection disabled, parses the XML content, and converts the DOM tree to a Node tree.
parse in class ParserinStream - the input stream containing XML contentParserException - if parsing failspublic Node parse(Node parentNode, Node domNode)
This is a convenience method that calls parse(Node, org.w3c.dom.Node, int) with
rank set to 0.
parentNode - the parent Node to attach parsed nodes todomNode - the DOM node to parse