Class Sax2Dom

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

    public class Sax2Dom
    extends org.xml.sax.helpers.DefaultHandler
    implements org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
    • Constructor Summary

      Constructors 
      Constructor Description
      Sax2Dom()  
      Sax2Dom​(org.w3c.dom.Node root)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] ch, int start, int length)  
      void comment​(char[] ch, int start, int length)
      Lexical Handler method to create comment node in DOM tree.
      void endCDATA()  
      void endDocument()  
      void endDTD()  
      void endElement​(java.lang.String namespace, java.lang.String localName, java.lang.String qName)  
      void endEntity​(java.lang.String name)  
      void endPrefixMapping​(java.lang.String prefix)  
      org.w3c.dom.Node getDOM()  
      void ignorableWhitespace​(char[] ch, int start, int length)
      This class is only used internally so this method should never be called.
      void processingInstruction​(java.lang.String target, java.lang.String data)
      adds processing instruction node to DOM.
      void setDocumentLocator​(org.xml.sax.Locator locator)
      This class is only used internally so this method should never be called.
      void skippedEntity​(java.lang.String name)
      This class is only used internally so this method should never be called.
      void startCDATA()  
      void startDocument()  
      void startDTD​(java.lang.String name, java.lang.String publicId, java.lang.String systemId)  
      void startElement​(java.lang.String namespace, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)  
      void startEntity​(java.lang.String name)  
      void startPrefixMapping​(java.lang.String prefix, java.lang.String uri)  
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

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

      • Sax2Dom

        public Sax2Dom()
                throws javax.xml.parsers.ParserConfigurationException
        Throws:
        javax.xml.parsers.ParserConfigurationException
      • Sax2Dom

        public Sax2Dom​(org.w3c.dom.Node root)
                throws javax.xml.parsers.ParserConfigurationException
        Throws:
        javax.xml.parsers.ParserConfigurationException
    • Method Detail

      • getDOM

        public org.w3c.dom.Node getDOM()
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.xml.sax.helpers.DefaultHandler
      • startDocument

        public void startDocument()
        Specified by:
        startDocument in interface org.xml.sax.ContentHandler
        Overrides:
        startDocument in class org.xml.sax.helpers.DefaultHandler
      • endDocument

        public void endDocument()
        Specified by:
        endDocument in interface org.xml.sax.ContentHandler
        Overrides:
        endDocument in class org.xml.sax.helpers.DefaultHandler
      • startElement

        public void startElement​(java.lang.String namespace,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes attrs)
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
      • endElement

        public void endElement​(java.lang.String namespace,
                               java.lang.String localName,
                               java.lang.String qName)
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
      • startPrefixMapping

        public void startPrefixMapping​(java.lang.String prefix,
                                       java.lang.String uri)
        Specified by:
        startPrefixMapping in interface org.xml.sax.ContentHandler
        Overrides:
        startPrefixMapping in class org.xml.sax.helpers.DefaultHandler
      • endPrefixMapping

        public void endPrefixMapping​(java.lang.String prefix)
        Specified by:
        endPrefixMapping in interface org.xml.sax.ContentHandler
        Overrides:
        endPrefixMapping in class org.xml.sax.helpers.DefaultHandler
      • ignorableWhitespace

        public void ignorableWhitespace​(char[] ch,
                                        int start,
                                        int length)
        This class is only used internally so this method should never be called.
        Specified by:
        ignorableWhitespace in interface org.xml.sax.ContentHandler
        Overrides:
        ignorableWhitespace in class org.xml.sax.helpers.DefaultHandler
      • processingInstruction

        public void processingInstruction​(java.lang.String target,
                                          java.lang.String data)
        adds processing instruction node to DOM.
        Specified by:
        processingInstruction in interface org.xml.sax.ContentHandler
        Overrides:
        processingInstruction in class org.xml.sax.helpers.DefaultHandler
      • setDocumentLocator

        public void setDocumentLocator​(org.xml.sax.Locator locator)
        This class is only used internally so this method should never be called.
        Specified by:
        setDocumentLocator in interface org.xml.sax.ContentHandler
        Overrides:
        setDocumentLocator in class org.xml.sax.helpers.DefaultHandler
      • skippedEntity

        public void skippedEntity​(java.lang.String name)
        This class is only used internally so this method should never be called.
        Specified by:
        skippedEntity in interface org.xml.sax.ContentHandler
        Overrides:
        skippedEntity in class org.xml.sax.helpers.DefaultHandler
      • comment

        public void comment​(char[] ch,
                            int start,
                            int length)
        Lexical Handler method to create comment node in DOM tree.
        Specified by:
        comment in interface org.xml.sax.ext.LexicalHandler
      • startCDATA

        public void startCDATA()
        Specified by:
        startCDATA in interface org.xml.sax.ext.LexicalHandler
      • endCDATA

        public void endCDATA()
        Specified by:
        endCDATA in interface org.xml.sax.ext.LexicalHandler
      • startEntity

        public void startEntity​(java.lang.String name)
        Specified by:
        startEntity in interface org.xml.sax.ext.LexicalHandler
      • endEntity

        public void endEntity​(java.lang.String name)
        Specified by:
        endEntity in interface org.xml.sax.ext.LexicalHandler
      • startDTD

        public void startDTD​(java.lang.String name,
                             java.lang.String publicId,
                             java.lang.String systemId)
                      throws org.xml.sax.SAXException
        Specified by:
        startDTD in interface org.xml.sax.ext.LexicalHandler
        Throws:
        org.xml.sax.SAXException
      • endDTD

        public void endDTD()
        Specified by:
        endDTD in interface org.xml.sax.ext.LexicalHandler