Class EventBase
- java.lang.Object
-
- com.sun.xml.fastinfoset.stax.events.EventBase
-
- All Implemented Interfaces:
javax.xml.stream.events.XMLEvent,javax.xml.stream.XMLStreamConstants
- Direct Known Subclasses:
AttributeBase,CharactersEvent,CommentEvent,DTDEvent,EndDocumentEvent,EndElementEvent,EntityDeclarationImpl,EntityReferenceEvent,ProcessingInstructionEvent,StartDocumentEvent,StartElementEvent
public abstract class EventBase extends java.lang.Object implements javax.xml.stream.events.XMLEvent
-
-
Field Summary
Fields Modifier and Type Field Description protected int_eventTypeprotected javax.xml.stream.Location_location
-
Method Summary
All Methods Instance 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.intgetEventType()Returns an integer code for this event.private java.lang.StringgetEventTypeString()javax.xml.stream.LocationgetLocation()Return the location of this event.javax.xml.namespace.QNamegetSchemaType()This method is provided for implementations to provide optional type information about the associated event.java.lang.StringgetSystemId()booleanisAttribute()A utility function to check if this event is an Attribute.booleanisCharacters()A utility function to check if this event is Characters.booleanisEndDocument()booleanisEndElement()booleanisEntityReference()booleanisNamespace()A utility function to check if this event is a Namespace.booleanisProcessingInstruction()booleanisStartDocument()booleanisStartElement()protected voidsetEventType(int eventType)voidsetLocation(javax.xml.stream.Location loc)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()
Returns an integer code for this event.- Specified by:
getEventTypein interfacejavax.xml.stream.events.XMLEvent
-
setEventType
protected void setEventType(int eventType)
-
isStartElement
public boolean isStartElement()
- Specified by:
isStartElementin interfacejavax.xml.stream.events.XMLEvent
-
isEndElement
public boolean isEndElement()
- Specified by:
isEndElementin interfacejavax.xml.stream.events.XMLEvent
-
isEntityReference
public boolean isEntityReference()
- Specified by:
isEntityReferencein interfacejavax.xml.stream.events.XMLEvent
-
isProcessingInstruction
public boolean isProcessingInstruction()
- Specified by:
isProcessingInstructionin interfacejavax.xml.stream.events.XMLEvent
-
isStartDocument
public boolean isStartDocument()
- Specified by:
isStartDocumentin interfacejavax.xml.stream.events.XMLEvent
-
isEndDocument
public boolean isEndDocument()
- Specified by:
isEndDocumentin interfacejavax.xml.stream.events.XMLEvent
-
getLocation
public javax.xml.stream.Location getLocation()
Return 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
-
setLocation
public void setLocation(javax.xml.stream.Location loc)
-
getSystemId
public java.lang.String getSystemId()
-
asCharacters
public javax.xml.stream.events.Characters asCharacters()
Returns 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
-
asEndElement
public 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.- Specified by:
asEndElementin interfacejavax.xml.stream.events.XMLEvent
-
asStartElement
public 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.- Specified by:
asStartElementin interfacejavax.xml.stream.events.XMLEvent
-
getSchemaType
public javax.xml.namespace.QName getSchemaType()
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:
getSchemaTypein interfacejavax.xml.stream.events.XMLEvent
-
isAttribute
public boolean isAttribute()
A utility function to check if this event is an Attribute.- Specified by:
isAttributein interfacejavax.xml.stream.events.XMLEvent- See Also:
Attribute
-
isCharacters
public boolean isCharacters()
A utility function to check if this event is Characters.- Specified by:
isCharactersin interfacejavax.xml.stream.events.XMLEvent- See Also:
Characters
-
isNamespace
public boolean isNamespace()
A utility function to check if this event is a Namespace.- Specified by:
isNamespacein interfacejavax.xml.stream.events.XMLEvent- See Also:
Namespace
-
writeAsEncodedUnicode
public void writeAsEncodedUnicode(java.io.Writer writer) throws javax.xml.stream.XMLStreamExceptionThis 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:
XMLStreamException- if there is a fatal error writing the event
-
getEventTypeString
private java.lang.String getEventTypeString()
-
-