org.cybergarage.xml.parser

## Class JaxpParser

- java.lang.Object
- - org.cybergarage.xml.Parser
  - - org.cybergarage.xml.parser.JaxpParser

- Direct Known Subclasses:
    XMLParser

      public class JaxpParser
      extends Parser

  JAXP-based XML parser implementation.

  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:

  - XXE attack prevention
  - DTD loading disabled
  - Null character filtering
  - Entity resolution blanking
  - DOM to Node tree conversion

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JaxpParser()` Creates a new JaxpParser instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class org.cybergarage.xml.Parser

      `parse, parse, parse`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JaxpParser

          public JaxpParser()

      Creates a new JaxpParser instance.

  - ### Method Detail

    - #### parse

          public Node parse(InputStream inStream)
                     throws ParserException

      Parses XML content from the specified input stream using JAXP.

      This method creates a secure DocumentBuilderFactory with XXE protection disabled, parses the XML content, and converts the DOM tree to a Node tree.

      Specified by:
        `parse` in class `Parser`
      Parameters:
        `inStream` - the input stream containing XML content
      Returns:
        the root node of the parsed XML document
      Throws:
        `ParserException` - if parsing fails

    - #### parse

          public Node parse(Node parentNode,
                            Node domNode)

      Parses a DOM node and converts it to a Node tree.

      This is a convenience method that calls `parse(Node, org.w3c.dom.Node, int)` with rank set to 0.

      Parameters:
        `parentNode` - the parent Node to attach parsed nodes to
        `domNode` - the DOM node to parse
      Returns:
        the parsed Node

    - #### parse

          public Node parse(Node parentNode,
                            Node domNode,
                            int rank)

      Recursively parses a DOM node and converts it to a Node tree.
      Parameters:
        `parentNode` - the parent Node to attach parsed nodes to
        `domNode` - the DOM node to parse
        `rank` - the recursion depth level (for debugging)
      Returns:
        the parsed Node