Class BaseEvent

    • Field Summary

      • Fields inherited from interface javax.xml.stream.XMLStreamConstants

        ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseEvent()  
      BaseEvent​(int type)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      javax.xml.stream.events.Characters asCharacters()
      Returns this event as Characters, may result in a class cast exception if this event is not Characters.
      javax.xml.stream.events.EndElement asEndElement()
      Returns this event as an end element event, may result in a class cast exception if this event is not a end element.
      javax.xml.stream.events.StartElement asStartElement()
      Returns this event as a start element event, may result in a class cast exception if this event is not a start element.
      protected abstract void doWriteAsEncodedUnicode​(java.io.Writer writer)
      Template method to be implemented by sub-classes.
      int getCharacterOffset()
      Return the byte or character offset into the input source this location is pointing to.
      int getColumnNumber()
      Return the column number where the current event ends, returns -1 if none is available.
      int getEventType()
      Returns an integer code for this event.
      int getLineNumber()
      Return the line number where the current event ends, returns -1 if none is available.
      javax.xml.stream.Location getLocation()
      Return the location of this event.
      java.lang.String getLocationURI()  
      java.lang.String getPublicId()
      Returns the public ID of the XML
      javax.xml.namespace.QName getSchemaType()
      This method is provided for implementations to provide optional type information about the associated event.
      java.lang.String getSourceName()  
      java.lang.String getSystemId()
      Returns the system ID of the XML
      java.lang.String getTypeAsString()  
      boolean isAttribute()
      A utility function to check if this event is an Attribute.
      boolean isCharacters()
      A utility function to check if this event is Characters.
      boolean isEndDocument()
      A utility function to check if this event is an EndDocument.
      boolean isEndElement()
      A utility function to check if this event is a EndElement.
      boolean isEntityReference()
      A utility function to check if this event is an EntityReference.
      boolean isNamespace()
      A utility function to check if this event is a Namespace.
      boolean isProcessingInstruction()
      A utility function to check if this event is a ProcessingInstruction.
      boolean isStartDocument()
      A utility function to check if this event is a StartDocument.
      boolean isStartElement()
      A utility function to check if this event is a StartElement.
      void recycle()  
      void setCharacterOffset​(int c)  
      void setColumnNumber​(int col)  
      protected void setEventType​(int type)  
      void setLineNumber​(int line)  
      void setLocationURI​(java.lang.String uri)  
      java.lang.String toString()  
      void writeAsEncodedUnicode​(java.io.Writer writer)
      This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
      • Methods inherited from class java.lang.Object

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

      • BaseEvent

        public BaseEvent()
      • BaseEvent

        public BaseEvent​(int type)
    • Method Detail

      • getEventType

        public int getEventType()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        Returns an integer code for this event.
        Specified by:
        getEventType in interface javax.xml.stream.events.XMLEvent
        See Also:
        XMLStreamConstants.START_ELEMENT, XMLStreamConstants.END_ELEMENT, XMLStreamConstants.CHARACTERS, XMLStreamConstants.ATTRIBUTE, XMLStreamConstants.NAMESPACE, XMLStreamConstants.PROCESSING_INSTRUCTION, XMLStreamConstants.COMMENT, XMLStreamConstants.START_DOCUMENT, XMLStreamConstants.END_DOCUMENT, XMLStreamConstants.DTD
      • setEventType

        protected void setEventType​(int type)
      • getTypeAsString

        public java.lang.String getTypeAsString()
      • isStartElement

        public boolean isStartElement()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is a StartElement.
        Specified by:
        isStartElement in interface javax.xml.stream.events.XMLEvent
        See Also:
        StartElement
      • isEndElement

        public boolean isEndElement()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is a EndElement.
        Specified by:
        isEndElement in interface javax.xml.stream.events.XMLEvent
        See Also:
        EndElement
      • isEntityReference

        public boolean isEntityReference()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is an EntityReference.
        Specified by:
        isEntityReference in interface javax.xml.stream.events.XMLEvent
        See Also:
        EntityReference
      • isProcessingInstruction

        public boolean isProcessingInstruction()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is a ProcessingInstruction.
        Specified by:
        isProcessingInstruction in interface javax.xml.stream.events.XMLEvent
        See Also:
        ProcessingInstruction
      • isCharacters

        public boolean isCharacters()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is Characters.
        Specified by:
        isCharacters in interface javax.xml.stream.events.XMLEvent
        See Also:
        Characters
      • isStartDocument

        public boolean isStartDocument()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is a StartDocument.
        Specified by:
        isStartDocument in interface javax.xml.stream.events.XMLEvent
        See Also:
        StartDocument
      • isEndDocument

        public boolean isEndDocument()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is an EndDocument.
        Specified by:
        isEndDocument in interface javax.xml.stream.events.XMLEvent
        See Also:
        EndDocument
      • isAttribute

        public boolean isAttribute()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is an Attribute.
        Specified by:
        isAttribute in interface javax.xml.stream.events.XMLEvent
        See Also:
        Attribute
      • isNamespace

        public boolean isNamespace()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        A utility function to check if this event is a Namespace.
        Specified by:
        isNamespace in interface javax.xml.stream.events.XMLEvent
        See Also:
        Namespace
      • getLocation

        public javax.xml.stream.Location getLocation()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        Return the location of this event. The Location returned from this method is non-volatile and will retain its information.
        Specified by:
        getLocation in interface javax.xml.stream.events.XMLEvent
        See Also:
        Location
      • getPublicId

        public java.lang.String getPublicId()
        Description copied from interface: javax.xml.stream.Location
        Returns the public ID of the XML
        Specified by:
        getPublicId in interface javax.xml.stream.Location
        Returns:
        the public ID, or null if not available
      • getSystemId

        public java.lang.String getSystemId()
        Description copied from interface: javax.xml.stream.Location
        Returns the system ID of the XML
        Specified by:
        getSystemId in interface javax.xml.stream.Location
        Returns:
        the system ID, or null if not available
      • getSourceName

        public java.lang.String getSourceName()
      • getLineNumber

        public int getLineNumber()
        Description copied from interface: javax.xml.stream.Location
        Return the line number where the current event ends, returns -1 if none is available.
        Specified by:
        getLineNumber in interface javax.xml.stream.Location
        Returns:
        the current line number
      • setLineNumber

        public void setLineNumber​(int line)
      • getColumnNumber

        public int getColumnNumber()
        Description copied from interface: javax.xml.stream.Location
        Return the column number where the current event ends, returns -1 if none is available.
        Specified by:
        getColumnNumber in interface javax.xml.stream.Location
        Returns:
        the current column number
      • setColumnNumber

        public void setColumnNumber​(int col)
      • getCharacterOffset

        public int getCharacterOffset()
        Description copied from interface: javax.xml.stream.Location
        Return the byte or character offset into the input source this location is pointing to. If the input source is a file or a byte stream then this is the byte offset into that stream, but if the input source is a character media then the offset is the character offset. Returns -1 if there is no offset available.
        Specified by:
        getCharacterOffset in interface javax.xml.stream.Location
        Returns:
        the current offset
      • setCharacterOffset

        public void setCharacterOffset​(int c)
      • getLocationURI

        public java.lang.String getLocationURI()
      • setLocationURI

        public void setLocationURI​(java.lang.String uri)
      • asStartElement

        public javax.xml.stream.events.StartElement asStartElement()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        Returns this event as a start element event, may result in a class cast exception if this event is not a start element.
        Specified by:
        asStartElement in interface javax.xml.stream.events.XMLEvent
      • asEndElement

        public javax.xml.stream.events.EndElement asEndElement()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        Returns this event as an end element event, may result in a class cast exception if this event is not a end element.
        Specified by:
        asEndElement in interface javax.xml.stream.events.XMLEvent
      • asCharacters

        public javax.xml.stream.events.Characters asCharacters()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        Returns this event as Characters, may result in a class cast exception if this event is not Characters.
        Specified by:
        asCharacters in interface javax.xml.stream.events.XMLEvent
      • recycle

        public void recycle()
      • getSchemaType

        public javax.xml.namespace.QName getSchemaType()
        Description copied from interface: javax.xml.stream.events.XMLEvent
        This method is provided for implementations to provide optional type information about the associated event. It is optional and will return null if no information is available.
        Specified by:
        getSchemaType in interface javax.xml.stream.events.XMLEvent
      • writeAsEncodedUnicode

        public final void writeAsEncodedUnicode​(java.io.Writer writer)
                                         throws javax.xml.stream.XMLStreamException
        Description copied from interface: javax.xml.stream.events.XMLEvent
        This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters. No indentation or whitespace should be outputted. Any user defined event type SHALL have this method called when being written to on an output stream. Built in Event types MUST implement this method, but implementations MAY choose not call these methods for optimizations reasons when writing out built in Events to an output stream. The output generated MUST be equivalent in terms of the infoset expressed.
        Specified by:
        writeAsEncodedUnicode in interface javax.xml.stream.events.XMLEvent
        Parameters:
        writer - The writer that will output the data
        Throws:
        javax.xml.stream.XMLStreamException
      • doWriteAsEncodedUnicode

        protected abstract void doWriteAsEncodedUnicode​(java.io.Writer writer)
                                                 throws java.io.IOException,
                                                        javax.xml.stream.XMLStreamException
        Template method to be implemented by sub-classes.
        Throws:
        java.io.IOException
        javax.xml.stream.XMLStreamException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object