Class SAX2DOMConverter

  • All Implemented Interfaces:

    public class SAX2DOMConverter
    extends java.lang.Object
    implements org.xml.sax.ContentHandler
    De-Serializes a document given by a sequence of SAX calls into a static w3c dom representation (in some local implementation, accessed via the JAXP architecture).
    Usage sequence: (1) call sdc = new SAX2DOMConverter()
    (2) call sdc.setDOMImplementation(DOMImplementation)
    (E.g. from javax.xml.parsers.DocumentBuilderFactory.newInstance() .newDocumentBuilder().getDOMImplementation()
    (3) send SAX events to sdc
    ATTENTION, document node and top-level element are already built!
    (4) call sdc.getDocument()
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] data, int start, int length)  
      void endDocument()  
      void endElement​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)  
      void endPrefixMapping​(java.lang.String prefix)  
      org.w3c.dom.Document getDocument()  
      org.w3c.dom.DOMImplementation getDOMImplementation()  
      void ignorableWhitespace​(char[] data, int start, int length)  
      void processingInstruction​(java.lang.String target, java.lang.String text)  
      void setDocumentLocator​(org.xml.sax.Locator locator)  
      void setDocumentURI​(java.lang.String documentUri)
      Goes directly to Document.
      void setDOMImplementation​(org.w3c.dom.DOMImplementation domImpl)  
      void skippedEntity​(java.lang.String name)  
      void startDocument()  
      void startDocument​(java.lang.String namespaceURI, java.lang.String qualifiedName)
      The two strings are the URI/local name of the top-level element ("document element").
      void startElement​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)  
      void startPrefixMapping​(java.lang.String prefix, java.lang.String namespaceURI)  
      • Methods inherited from class java.lang.Object

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

      • SAX2DOMConverter

        public SAX2DOMConverter()
    • Method Detail

      • setDOMImplementation

        public void setDOMImplementation​(org.w3c.dom.DOMImplementation domImpl)
      • getDOMImplementation

        public org.w3c.dom.DOMImplementation getDOMImplementation()
      • startDocument

        public void startDocument​(java.lang.String namespaceURI,
                                  java.lang.String qualifiedName)
        The two strings are the URI/local name of the top-level element ("document element"). This is created together with the document object.
      • setDocumentURI

        public void setDocumentURI​(java.lang.String documentUri)
        Goes directly to Document. Can be called once, before or after {@#startDocument(String,String).
      • getDocument

        public org.w3c.dom.Document getDocument()
      • startElement

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

        public void endElement​(java.lang.String namespaceURI,
                               java.lang.String localName,
                               java.lang.String qName)
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
      • characters

        public void characters​(char[] data,
                               int start,
                               int length)
        Specified by:
        characters in interface org.xml.sax.ContentHandler
      • endDocument

        public void endDocument()
        Specified by:
        endDocument in interface org.xml.sax.ContentHandler
      • endPrefixMapping

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

        public void ignorableWhitespace​(char[] data,
                                        int start,
                                        int length)
        Specified by:
        ignorableWhitespace in interface org.xml.sax.ContentHandler
      • processingInstruction

        public void processingInstruction​(java.lang.String target,
                                          java.lang.String text)
        Specified by:
        processingInstruction in interface org.xml.sax.ContentHandler
      • skippedEntity

        public void skippedEntity​(java.lang.String name)
        Specified by:
        skippedEntity in interface org.xml.sax.ContentHandler
      • setDocumentLocator

        public void setDocumentLocator​(org.xml.sax.Locator locator)
        Specified by:
        setDocumentLocator in interface org.xml.sax.ContentHandler
      • startDocument

        public void startDocument()
        Specified by:
        startDocument in interface org.xml.sax.ContentHandler
      • startPrefixMapping

        public void startPrefixMapping​(java.lang.String prefix,
                                       java.lang.String namespaceURI)
        Specified by:
        startPrefixMapping in interface org.xml.sax.ContentHandler