Class BaseSax2EventFromStaxProducer

    • Constructor Detail

      • BaseSax2EventFromStaxProducer

        public BaseSax2EventFromStaxProducer()
    • Method Detail

      • createSax2EventFromStax

        public static SAX2EventAndErrorProducer createSax2EventFromStax​(javax.xml.stream.XMLStreamReader streamReader)
      • createSax2EventFromStax

        public static SAX2EventAndErrorProducer createSax2EventFromStax​(javax.xml.stream.XMLEventReader eventReader)
      • setContentHandler

        public void setContentHandler​(org.xml.sax.ContentHandler contentHandler)
        Description copied from interface: SAX2EventProducer
        Sets the SAX2 ContentHandler to send SAX 2 events to
        Specified by:
        setContentHandler in interface SAX2EventProducer
      • getPrefixes

        public java.util.Stack<java.util.List<java.lang.String>> getPrefixes()
      • getContentHandler

        public org.xml.sax.ContentHandler getContentHandler()
      • getErrorHandler

        public org.xml.sax.ErrorHandler getErrorHandler()
      • handleEventType

        int handleEventType​(int eventType,
                            int depth)
                     throws org.xml.sax.SAXException
        This method takes an eventType and invokes a method to handle that event.

        It also takes information about the depth of the read element. Maybe depth changes due to handling that event.

        Parameters:
        eventType - The event type
        depth - The current depth of the element
        Returns:
        depth The updated depth
        Throws:
        org.xml.sax.SAXException
      • handleStartDocument

        void handleStartDocument()
                          throws org.xml.sax.SAXException
        Invoke handleDocumentLocator() and {@link getContentHandler().startDocument()};
        Throws:
        org.xml.sax.SAXException
      • handleEndDocument

        void handleEndDocument()
                        throws org.xml.sax.SAXException
        Handles a end document event.

        Invoke {@link getContentHandler().endDocument()};

        Throws:
        org.xml.sax.SAXException
      • handleStartElement

        void handleStartElement()
                         throws org.xml.sax.SAXException
        Handles a start element event.

        Invoke doStartPrefixMapping() and {@link getContentHandler().startElement()};

        Throws:
        org.xml.sax.SAXException
      • handleEndElement

        void handleEndElement()
                       throws org.xml.sax.SAXException
        Handles an end element event.

        Invoke {@link getContentHandler().endElement()} and doEndPrefixMapping();

        Throws:
        org.xml.sax.SAXException
      • handleSpace

        void handleSpace()
                  throws org.xml.sax.SAXException
        Handles a space event.
        Throws:
        org.xml.sax.SAXException
      • handleCharacters

        void handleCharacters()
                       throws org.xml.sax.SAXException
        Handles a character event.

        If chars is ignorable whitespace {@link getContentHandler().ignorableWhitespace will be called. Otherwise {@link getContentHandler().characters()} will be called with characters(char[], 0, length)

        Throws:
        org.xml.sax.SAXException
      • getQName

        java.lang.String getQName​(java.lang.String prefix,
                                  java.lang.String localPart)
        Parameters:
        prefix -
        localPart -
        Returns:
        qName. If prefix length >=1 then it's like prefix:localPart, otherwise it's just the localPart
      • isIgnorableWhitespace

        boolean isIgnorableWhitespace​(char[] chars,
                                      int start,
                                      int length)
        If a chars without leading and trailing whitespaces would be empty, this method returns true, otherwise false,
        Parameters:
        chars -
        start - the offset
        length -
        Returns:
      • getNonEmpty

        java.lang.String getNonEmpty​(java.lang.String string)
        If string equals null this returns an empty string, otherwise it returns the string
        Parameters:
        string - the string to check
        Returns:
        a string. If string equals null this returns an empty string, otherwise it returns the string
      • getLocation

        abstract javax.xml.stream.Location getLocation()
        Returns:
        a Location
      • getCharacters

        abstract char[] getCharacters()
        Returns:
        characters of the current event.
      • doStartPrefixMapping

        abstract void doStartPrefixMapping()
                                    throws org.xml.sax.SAXException
        For every declared namespace in the current event {@link getContentHandler().startPrefixMapping()} gets invoked.
        Throws:
        org.xml.sax.SAXException
      • doEndPrefixMapping

        abstract void doEndPrefixMapping()
                                  throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • getAttributes

        abstract org.xml.sax.Attributes getAttributes()
        Returns:
        attributes of the current event
      • getQName

        abstract javax.xml.namespace.QName getQName()
        Returns:
        QName of the current event
      • getSAXLocator

        protected org.xml.sax.Locator getSAXLocator​(javax.xml.stream.Location location)
        Gets a Locator to a given Location.
        Parameters:
        location - A Location
        Returns:
        A Locator