Class NodeletParser


  • public class NodeletParser
    extends java.lang.Object
    The NodeletParser is a callback based parser similar to SAX. The big difference is that rather than having a single callback for all nodes, the NodeletParser has a number of callbacks mapped to various nodes. The callback is called a Nodelet and it is registered with the NodeletParser against a specific XPath.
    • Constructor Detail

      • NodeletParser

        public NodeletParser​(java.lang.Object nodeParser)
    • Method Detail

      • getNodeParser

        public <N> N getNodeParser()
      • setValidating

        public void setValidating​(boolean validating)
      • setEntityResolver

        public void setEntityResolver​(org.xml.sax.EntityResolver entityResolver)
      • trackingLocation

        public NodeTracker trackingLocation()
      • getXpath

        public java.lang.String getXpath()
      • setXpath

        public void setXpath​(java.lang.String xpath)
      • addNodelet

        public void addNodelet​(Nodelet nodelet)
        Registers a nodelet to process attributes for the specified XPath. It supports the following XPaths:
        • Element Path - /rootElement/childElement/theElement
        Parameters:
        nodelet - the nodelet for processing start elements and attributes
      • addNodeEndlet

        public void addNodeEndlet​(NodeEndlet endlet)
        Registers the nodelet to process the end elements of the specified XPath and the text and CDATA data collected.
        Parameters:
        endlet - the nodelet for processing end elements, text and CDATA data collected
      • addNodelet

        public void addNodelet​(NodeletAdder nodeletAdder)
        Adds the nodelet.
        Parameters:
        nodeletAdder - the nodelet adder
      • addNodelet

        public void addNodelet​(java.lang.String xpath,
                               NodeletAdder nodeletAdder)
        Adds the nodelet.
        Parameters:
        xpath - the xpath
        nodeletAdder - the nodelet adder
      • pushObject

        public void pushObject​(java.lang.Object object)
      • popObject

        public <T> T popObject()
      • peekObject

        public <T> T peekObject()
      • peekObject

        public <T> T peekObject​(int n)
      • peekObject

        public <T> T peekObject​(java.lang.Class<?> target)
      • clearObjectStack

        public void clearObjectStack()
        Clear object stack.
      • parse

        public void parse​(java.io.Reader reader)
                   throws NodeletException
        Begins parsing from the provided Reader.
        Parameters:
        reader - the reader
        Throws:
        NodeletException - the nodelet exception
      • parse

        public void parse​(java.io.InputStream inputStream)
                   throws NodeletException
        Begins parsing from the provided InputStream.
        Parameters:
        inputStream - the input stream
        Throws:
        NodeletException - the nodelet exception
      • parse

        public void parse​(org.xml.sax.InputSource inputSource)
                   throws NodeletException
        Begins parsing from the provided InputSource.
        Parameters:
        inputSource - the input source
        Throws:
        NodeletException - the nodelet exception