Class StaxEventContentHandler

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler

    public class StaxEventContentHandler
    extends java.lang.Object
    SAX ContentHandler that transforms callback calls to XMLEvents and writes them to a XMLEventConsumer.
    • Constructor Detail

      • StaxEventContentHandler

        public StaxEventContentHandler​(javax.xml.stream.util.XMLEventConsumer consumer)
        Constructs a new instance of the StaxEventContentHandler that writes to the given XMLEventConsumer. A default XMLEventFactory will be created.
        Parameters:
        consumer - the consumer to write events to
      • StaxEventContentHandler

        public StaxEventContentHandler​(javax.xml.stream.util.XMLEventConsumer consumer,
                                       javax.xml.stream.XMLEventFactory factory)
        Constructs a new instance of the StaxEventContentHandler that uses the given event factory to create events and writes to the given XMLEventConsumer.
        Parameters:
        consumer - the consumer to write events to
        factory - the factory used to create events
    • Method Detail

      • setDocumentLocator

        public void setDocumentLocator​(org.xml.sax.Locator locator)
      • startDocumentInternal

        protected void startDocumentInternal()
                                      throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • endDocumentInternal

        protected void endDocumentInternal()
                                    throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • startElementInternal

        protected void startElementInternal​(javax.xml.namespace.QName name,
                                            org.xml.sax.Attributes atts,
                                            SimpleNamespaceContext namespaceContext)
                                     throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • endElementInternal

        protected void endElementInternal​(javax.xml.namespace.QName name,
                                          SimpleNamespaceContext namespaceContext)
                                   throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • charactersInternal

        protected void charactersInternal​(char[] ch,
                                          int start,
                                          int length)
                                   throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • ignorableWhitespaceInternal

        protected void ignorableWhitespaceInternal​(char[] ch,
                                                   int start,
                                                   int length)
                                            throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • processingInstructionInternal

        protected void processingInstructionInternal​(java.lang.String target,
                                                     java.lang.String data)
                                              throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • skippedEntityInternal

        protected void skippedEntityInternal​(java.lang.String name)
                                      throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
      • startDocument

        public final void startDocument()
                                 throws org.xml.sax.SAXException
        Specified by:
        startDocument in interface org.xml.sax.ContentHandler
        Throws:
        org.xml.sax.SAXException
      • endDocument

        public final void endDocument()
                               throws org.xml.sax.SAXException
        Specified by:
        endDocument in interface org.xml.sax.ContentHandler
        Throws:
        org.xml.sax.SAXException
      • startPrefixMapping

        public final void startPrefixMapping​(java.lang.String prefix,
                                             java.lang.String uri)
        Binds the given prefix to the given namespaces.
        Specified by:
        startPrefixMapping in interface org.xml.sax.ContentHandler
        See Also:
        SimpleNamespaceContext.bindNamespaceUri(String, String)
      • endPrefixMapping

        public final void endPrefixMapping​(java.lang.String prefix)
        Removes the binding for the given prefix.
        Specified by:
        endPrefixMapping in interface org.xml.sax.ContentHandler
        See Also:
        SimpleNamespaceContext.removeBinding(String)
      • startElement

        public final void startElement​(java.lang.String uri,
                                       java.lang.String localName,
                                       java.lang.String qName,
                                       org.xml.sax.Attributes atts)
                                throws org.xml.sax.SAXException
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Throws:
        org.xml.sax.SAXException
      • endElement

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

        public final void characters​(char[] ch,
                                     int start,
                                     int length)
                              throws org.xml.sax.SAXException
        Specified by:
        characters in interface org.xml.sax.ContentHandler
        Throws:
        org.xml.sax.SAXException
      • ignorableWhitespace

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

        public final void processingInstruction​(java.lang.String target,
                                                java.lang.String data)
                                         throws org.xml.sax.SAXException
        Specified by:
        processingInstruction in interface org.xml.sax.ContentHandler
        Throws:
        org.xml.sax.SAXException
      • skippedEntity

        public final void skippedEntity​(java.lang.String name)
                                 throws org.xml.sax.SAXException
        Specified by:
        skippedEntity in interface org.xml.sax.ContentHandler
        Throws:
        org.xml.sax.SAXException