Package com.bea.xml.stream.events
Class BaseEvent
- java.lang.Object
-
- com.bea.xml.stream.events.BaseEvent
-
- All Implemented Interfaces:
javax.xml.stream.events.XMLEvent,javax.xml.stream.Location,javax.xml.stream.XMLStreamConstants
- Direct Known Subclasses:
CharactersEvent,DTDEvent,EndDocumentEvent,EntityDeclarationEvent,EntityReferenceEvent,NamedEvent,NotationDeclarationEvent,ProcessingInstructionEvent,StartDocumentEvent
public abstract class BaseEvent extends java.lang.Object implements javax.xml.stream.events.XMLEvent, javax.xml.stream.LocationBase event class for events to extend from
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.xml.stream.events.CharactersasCharacters()Returns this event as Characters, may result in a class cast exception if this event is not Characters.javax.xml.stream.events.EndElementasEndElement()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.StartElementasStartElement()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 voiddoWriteAsEncodedUnicode(java.io.Writer writer)Template method to be implemented by sub-classes.intgetCharacterOffset()Return the byte or character offset into the input source this location is pointing to.intgetColumnNumber()Return the column number where the current event ends, returns -1 if none is available.intgetEventType()Returns an integer code for this event.intgetLineNumber()Return the line number where the current event ends, returns -1 if none is available.javax.xml.stream.LocationgetLocation()Return the location of this event.java.lang.StringgetLocationURI()java.lang.StringgetPublicId()Returns the public ID of the XMLjavax.xml.namespace.QNamegetSchemaType()This method is provided for implementations to provide optional type information about the associated event.java.lang.StringgetSourceName()java.lang.StringgetSystemId()Returns the system ID of the XMLjava.lang.StringgetTypeAsString()booleanisAttribute()A utility function to check if this event is an Attribute.booleanisCharacters()A utility function to check if this event is Characters.booleanisEndDocument()A utility function to check if this event is an EndDocument.booleanisEndElement()A utility function to check if this event is a EndElement.booleanisEntityReference()A utility function to check if this event is an EntityReference.booleanisNamespace()A utility function to check if this event is a Namespace.booleanisProcessingInstruction()A utility function to check if this event is a ProcessingInstruction.booleanisStartDocument()A utility function to check if this event is a StartDocument.booleanisStartElement()A utility function to check if this event is a StartElement.voidrecycle()voidsetCharacterOffset(int c)voidsetColumnNumber(int col)protected voidsetEventType(int type)voidsetLineNumber(int line)voidsetLocationURI(java.lang.String uri)java.lang.StringtoString()voidwriteAsEncodedUnicode(java.io.Writer writer)This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-
-
-
Method Detail
-
getEventType
public int getEventType()
Description copied from interface:javax.xml.stream.events.XMLEventReturns an integer code for this event.- Specified by:
getEventTypein interfacejavax.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.XMLEventA utility function to check if this event is a StartElement.- Specified by:
isStartElementin interfacejavax.xml.stream.events.XMLEvent- See Also:
StartElement
-
isEndElement
public boolean isEndElement()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a EndElement.- Specified by:
isEndElementin interfacejavax.xml.stream.events.XMLEvent- See Also:
EndElement
-
isEntityReference
public boolean isEntityReference()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is an EntityReference.- Specified by:
isEntityReferencein interfacejavax.xml.stream.events.XMLEvent- See Also:
EntityReference
-
isProcessingInstruction
public boolean isProcessingInstruction()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a ProcessingInstruction.- Specified by:
isProcessingInstructionin interfacejavax.xml.stream.events.XMLEvent- See Also:
ProcessingInstruction
-
isCharacters
public boolean isCharacters()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is Characters.- Specified by:
isCharactersin interfacejavax.xml.stream.events.XMLEvent- See Also:
Characters
-
isStartDocument
public boolean isStartDocument()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a StartDocument.- Specified by:
isStartDocumentin interfacejavax.xml.stream.events.XMLEvent- See Also:
StartDocument
-
isEndDocument
public boolean isEndDocument()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is an EndDocument.- Specified by:
isEndDocumentin interfacejavax.xml.stream.events.XMLEvent- See Also:
EndDocument
-
isAttribute
public boolean isAttribute()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is an Attribute.- Specified by:
isAttributein interfacejavax.xml.stream.events.XMLEvent- See Also:
Attribute
-
isNamespace
public boolean isNamespace()
Description copied from interface:javax.xml.stream.events.XMLEventA utility function to check if this event is a Namespace.- Specified by:
isNamespacein interfacejavax.xml.stream.events.XMLEvent- See Also:
Namespace
-
getLocation
public javax.xml.stream.Location getLocation()
Description copied from interface:javax.xml.stream.events.XMLEventReturn the location of this event. The Location returned from this method is non-volatile and will retain its information.- Specified by:
getLocationin interfacejavax.xml.stream.events.XMLEvent- See Also:
Location
-
getPublicId
public java.lang.String getPublicId()
Description copied from interface:javax.xml.stream.LocationReturns the public ID of the XML- Specified by:
getPublicIdin interfacejavax.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.LocationReturns the system ID of the XML- Specified by:
getSystemIdin interfacejavax.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.LocationReturn the line number where the current event ends, returns -1 if none is available.- Specified by:
getLineNumberin interfacejavax.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.LocationReturn the column number where the current event ends, returns -1 if none is available.- Specified by:
getColumnNumberin interfacejavax.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.LocationReturn 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:
getCharacterOffsetin interfacejavax.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.XMLEventReturns this event as a start element event, may result in a class cast exception if this event is not a start element.- Specified by:
asStartElementin interfacejavax.xml.stream.events.XMLEvent
-
asEndElement
public javax.xml.stream.events.EndElement asEndElement()
Description copied from interface:javax.xml.stream.events.XMLEventReturns this event as an end element event, may result in a class cast exception if this event is not a end element.- Specified by:
asEndElementin interfacejavax.xml.stream.events.XMLEvent
-
asCharacters
public javax.xml.stream.events.Characters asCharacters()
Description copied from interface:javax.xml.stream.events.XMLEventReturns this event as Characters, may result in a class cast exception if this event is not Characters.- Specified by:
asCharactersin interfacejavax.xml.stream.events.XMLEvent
-
recycle
public void recycle()
-
getSchemaType
public javax.xml.namespace.QName getSchemaType()
Description copied from interface:javax.xml.stream.events.XMLEventThis 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:
getSchemaTypein interfacejavax.xml.stream.events.XMLEvent
-
writeAsEncodedUnicode
public final void writeAsEncodedUnicode(java.io.Writer writer) throws javax.xml.stream.XMLStreamExceptionDescription copied from interface:javax.xml.stream.events.XMLEventThis 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:
writeAsEncodedUnicodein interfacejavax.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.XMLStreamExceptionTemplate method to be implemented by sub-classes.- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-