Class StAXEventReader

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.Object>, javax.xml.stream.XMLEventReader

    public class StAXEventReader
    extends java.lang.Object
    implements javax.xml.stream.XMLEventReader
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.xml.stream.events.XMLEvent _currentEvent  
      protected javax.xml.stream.util.XMLEventAllocator _eventAllocator  
      protected javax.xml.stream.XMLStreamReader _streamReader  
      private int currentIndex  
      private javax.xml.stream.events.XMLEvent[] events  
      private boolean hasEvent  
      private int size  
    • Constructor Summary

      Constructors 
      Constructor Description
      StAXEventReader​(javax.xml.stream.XMLStreamReader reader)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.lang.String getElementText()
      Reads the content of a text-only element.
      java.lang.Object getProperty​(java.lang.String name)
      Get the value of a feature/property from the underlying implementation
      boolean hasNext()  
      java.lang.Object next()  
      javax.xml.stream.events.XMLEvent nextEvent()  
      javax.xml.stream.events.XMLEvent nextTag()
      Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached.
      javax.xml.stream.events.XMLEvent peek()  
      void remove()  
      void setAllocator​(javax.xml.stream.util.XMLEventAllocator allocator)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Field Detail

      • _streamReader

        protected javax.xml.stream.XMLStreamReader _streamReader
      • _eventAllocator

        protected javax.xml.stream.util.XMLEventAllocator _eventAllocator
      • _currentEvent

        private javax.xml.stream.events.XMLEvent _currentEvent
      • events

        private javax.xml.stream.events.XMLEvent[] events
      • size

        private int size
      • currentIndex

        private int currentIndex
      • hasEvent

        private boolean hasEvent
    • Constructor Detail

      • StAXEventReader

        public StAXEventReader​(javax.xml.stream.XMLStreamReader reader)
                        throws javax.xml.stream.XMLStreamException
        Throws:
        javax.xml.stream.XMLStreamException
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.Object>
        Specified by:
        hasNext in interface javax.xml.stream.XMLEventReader
      • nextEvent

        public javax.xml.stream.events.XMLEvent nextEvent()
                                                   throws javax.xml.stream.XMLStreamException
        Specified by:
        nextEvent in interface javax.xml.stream.XMLEventReader
        Throws:
        javax.xml.stream.XMLStreamException
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<java.lang.Object>
      • close

        public void close()
                   throws javax.xml.stream.XMLStreamException
        Specified by:
        close in interface javax.xml.stream.XMLEventReader
        Throws:
        javax.xml.stream.XMLStreamException
      • getElementText

        public java.lang.String getElementText()
                                        throws javax.xml.stream.XMLStreamException
        Reads the content of a text-only element. Precondition: the current event is START_ELEMENT. Postcondition: The current event is the corresponding END_ELEMENT.
        Specified by:
        getElementText in interface javax.xml.stream.XMLEventReader
        Throws:
        javax.xml.stream.XMLStreamException - if the current event is not a START_ELEMENT or if a non text element is encountered
      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
                                     throws java.lang.IllegalArgumentException
        Get the value of a feature/property from the underlying implementation
        Specified by:
        getProperty in interface javax.xml.stream.XMLEventReader
        Parameters:
        name - The name of the property
        Returns:
        The value of the property
        Throws:
        java.lang.IllegalArgumentException - if the property is not supported
      • nextTag

        public javax.xml.stream.events.XMLEvent nextTag()
                                                 throws javax.xml.stream.XMLStreamException
        Skips any insignificant space events until a START_ELEMENT or END_ELEMENT is reached. If anything other than space characters are encountered, an exception is thrown. This method should be used when processing element-only content because the parser is not able to recognize ignorable whitespace if the DTD is missing or not interpreted.
        Specified by:
        nextTag in interface javax.xml.stream.XMLEventReader
        Throws:
        javax.xml.stream.XMLStreamException - if anything other than space characters are encountered
      • next

        public java.lang.Object next()
        Specified by:
        next in interface java.util.Iterator<java.lang.Object>
      • peek

        public javax.xml.stream.events.XMLEvent peek()
                                              throws javax.xml.stream.XMLStreamException
        Specified by:
        peek in interface javax.xml.stream.XMLEventReader
        Throws:
        javax.xml.stream.XMLStreamException
      • setAllocator

        public void setAllocator​(javax.xml.stream.util.XMLEventAllocator allocator)