Class XPNBuilder

  • All Implemented Interfaces:
    ResultHandler, org.xml.sax.DocumentHandler

    public class XPNBuilder
    extends java.lang.Object
    implements ResultHandler
    A ResultHandler implementation that builds a XPathNode tree
    Version:
    $Revision: 3916 $ $Date: 2003-09-29 21:32:17 +0200 (Mon, 29 Sep 2003) $
    Author:
    Keith Visco
    • Constructor Summary

      Constructors 
      Constructor Description
      XPNBuilder()
      Creates a new XPNBuilder
      XPNBuilder​(java.lang.String documentURI)
      Creates a new XPNBuilder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cdata​(char[] chars, int start, int length)
      Signals to receive CDATA characters
      void characters​(char[] chars, int start, int length)
      Signals the start of characters
      void comment​(java.lang.String data)
      Signals to recieve a comment
      void endDocument()
      Signals the end of the document
      void endElement​(java.lang.String name)
      Signals the start of element
      void endFragment()  
      void entityReference​(java.lang.String name)
      Signals to recieve an entity reference with the given name
      XPathNode getCurrentNode()
      Returns the current node
      XPathNode getRoot()
      Returns the Root node
      void ignorableWhitespace​(char[] chars, int start, int length)
      Signals the start of ignorable whitespace characters
      boolean isFinished()
      Returns true if the DOM builder has completed
      void processingInstruction​(java.lang.String target, java.lang.String data)
      Signals to recieve a processing instruction
      void setDocumentLocator​(org.xml.sax.Locator locator)
      Sets the document locator
      void setEscapeText​(boolean escapeText)
      Sets the behavoir of handling character content.
      void setIndentSize​(short indentSize)
      Sets the indent size for all formatters that perform serialization, in which indentation is applicable.
      void setOutputFormat​(OutputFormat format)
      Sets the output format information for Formatters that perform serialization.
      void setSaveLocation​(boolean saveLocation)
      Sets whether or not to save location information.
      void startDocument()
      Signals the start of a document
      void startElement​(java.lang.String name, org.xml.sax.AttributeList atts)
      Signals the start of element
      XPathNode startFragment()
      Starts a documentFragment and returns a handle to the fragment This fragment won't be added to the DOM tree
      void unescapedCharacters​(char[] chars, int start, int length)
      Signals to receive characters which should not be escaped
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XPNBuilder

        public XPNBuilder()
        Creates a new XPNBuilder
      • XPNBuilder

        public XPNBuilder​(java.lang.String documentURI)
        Creates a new XPNBuilder
    • Method Detail

      • cdata

        public void cdata​(char[] chars,
                          int start,
                          int length)
        Signals to receive CDATA characters
        Specified by:
        cdata in interface ResultHandler
        Parameters:
        chars - the character array containing the characters to receive
        start - the index into the character array to start receiving characters at
        length - the number of characters to recieve
      • characters

        public void characters​(char[] chars,
                               int start,
                               int length)
                        throws org.xml.sax.SAXException
        Signals the start of characters
        Specified by:
        characters in interface org.xml.sax.DocumentHandler
        Parameters:
        chars - the character array containing the characters to receive
        start - the index into the character array to start receiving characters at
        length - the number of characters to recieve
        Throws:
        org.xml.sax.SAXException
      • comment

        public void comment​(java.lang.String data)
        Description copied from interface: ResultHandler
        Signals to recieve a comment
        Specified by:
        comment in interface ResultHandler
        Parameters:
        data - , the content of the comment
      • endDocument

        public void endDocument()
                         throws org.xml.sax.SAXException
        Signals the end of the document
        Specified by:
        endDocument in interface org.xml.sax.DocumentHandler
        Throws:
        org.xml.sax.SAXException
      • endElement

        public void endElement​(java.lang.String name)
                        throws org.xml.sax.SAXException
        Signals the start of element
        Specified by:
        endElement in interface org.xml.sax.DocumentHandler
        Parameters:
        name - the name of the element
        atts - the AttributeList containing the associated attributes for the element
        Throws:
        org.xml.sax.SAXException
      • entityReference

        public void entityReference​(java.lang.String name)
        Signals to recieve an entity reference with the given name
        Specified by:
        entityReference in interface ResultHandler
        Parameters:
        name - the name of the entity reference
      • startFragment

        public XPathNode startFragment()
        Starts a documentFragment and returns a handle to the fragment This fragment won't be added to the DOM tree
      • endFragment

        public void endFragment()
      • getCurrentNode

        public XPathNode getCurrentNode()
        Returns the current node
        Returns:
        the current node
      • getRoot

        public XPathNode getRoot()
        Returns the Root node
        Returns:
        the root node
      • ignorableWhitespace

        public void ignorableWhitespace​(char[] chars,
                                        int start,
                                        int length)
                                 throws org.xml.sax.SAXException
        Signals the start of ignorable whitespace characters
        Specified by:
        ignorableWhitespace in interface org.xml.sax.DocumentHandler
        Parameters:
        chars - the character array containing the characters to receive
        start - the index into the character array to start receiving characters at
        length - the number of characters to recieve
        Throws:
        org.xml.sax.SAXException
      • isFinished

        public boolean isFinished()
        Returns true if the DOM builder has completed
        Returns:
        true if the DOM builder has completed
      • processingInstruction

        public void processingInstruction​(java.lang.String target,
                                          java.lang.String data)
                                   throws org.xml.sax.SAXException
        Signals to recieve a processing instruction
        Specified by:
        processingInstruction in interface org.xml.sax.DocumentHandler
        Parameters:
        target - the target of the processing instruction
        data - the content of the processing instruction
        Throws:
        org.xml.sax.SAXException
      • setDocumentLocator

        public void setDocumentLocator​(org.xml.sax.Locator locator)
        Sets the document locator
        Specified by:
        setDocumentLocator in interface org.xml.sax.DocumentHandler
        Parameters:
        locator - the Locator used by this DocumentHandler
      • setEscapeText

        public void setEscapeText​(boolean escapeText)
        Sets the behavoir of handling character content. If argument is true, character content will be escaped. If false, character content will not be escaped.
        Parameters:
        escapeText - the flag indicating whether or not to escape character content
      • setIndentSize

        public void setIndentSize​(short indentSize)
        Sets the indent size for all formatters that perform serialization, in which indentation is applicable.
        Specified by:
        setIndentSize in interface ResultHandler
        Parameters:
        indentSize - the number of characters to indent
      • setOutputFormat

        public void setOutputFormat​(OutputFormat format)
        Sets the output format information for Formatters that perform serialization.
        Specified by:
        setOutputFormat in interface ResultHandler
        Parameters:
        format - the OutputFormat used to specify properties during serialization
      • setSaveLocation

        public void setSaveLocation​(boolean saveLocation)
        Sets whether or not to save location information. Location information can only be saved if the Locator has been set by the SAX Parser.
        Parameters:
        saveLocation - a boolean that when true, indicates that location information should be saved if possible.
      • startDocument

        public void startDocument()
                           throws org.xml.sax.SAXException
        Signals the start of a document
        Specified by:
        startDocument in interface org.xml.sax.DocumentHandler
        Throws:
        org.xml.sax.SAXException
      • startElement

        public void startElement​(java.lang.String name,
                                 org.xml.sax.AttributeList atts)
                          throws org.xml.sax.SAXException
        Signals the start of element
        Specified by:
        startElement in interface org.xml.sax.DocumentHandler
        Parameters:
        name - the name of the element
        atts - the AttributeList containing the associated attributes for the element
        Throws:
        org.xml.sax.SAXException
      • unescapedCharacters

        public void unescapedCharacters​(char[] chars,
                                        int start,
                                        int length)
        Signals to receive characters which should not be escaped
        Specified by:
        unescapedCharacters in interface ResultHandler
        Parameters:
        chars - the character array containing the characters to receive
        start - the index into the character array to start receiving characters at
        length - the number of characters to recieve