Class BaseEvent
java.lang.Object
com.bea.xml.stream.events.BaseEvent
- All Implemented Interfaces:
XMLEvent, Location, XMLStreamConstants
- Direct Known Subclasses:
CharactersEvent, DTDEvent, EndDocumentEvent, EntityDeclarationEvent, EntityReferenceEvent, NamedEvent, NotationDeclarationEvent, ProcessingInstructionEvent, StartDocumentEvent
-
Field Summary
Fields inherited from interface 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 -
Method Summary
Modifier and TypeMethodDescriptionReturns this event as Characters, may result in a class cast exception if this event is not Characters.Returns this event as an end element event, may result in a class cast exception if this event is not a end element.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(Writer writer) Template method to be implemented by sub-classes.intReturn the byte or character offset into the input source this location is pointing to.intReturn the column number where the current event ends, returns -1 if none is available.intReturns an integer code for this event.intReturn the line number where the current event ends, returns -1 if none is available.Return the location of this event.Returns the public ID of the XMLThis method is provided for implementations to provide optional type information about the associated event.Returns the system ID of the XMLbooleanA utility function to check if this event is an Attribute.booleanA utility function to check if this event is Characters.booleanA utility function to check if this event is an EndDocument.booleanA utility function to check if this event is a EndElement.booleanA utility function to check if this event is an EntityReference.booleanA utility function to check if this event is a Namespace.booleanA utility function to check if this event is a ProcessingInstruction.booleanA utility function to check if this event is a StartDocument.booleanA 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(String uri) toString()final voidwriteAsEncodedUnicode(Writer writer) This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-
Constructor Details
-
BaseEvent
public BaseEvent() -
BaseEvent
public BaseEvent(int type)
-
-
Method Details
-
getEventType
public int getEventType()Description copied from interface:javax.xml.stream.events.XMLEventReturns an integer code for this event.- Specified by:
getEventTypein interfaceXMLEvent- See Also:
-
setEventType
protected void setEventType(int type) -
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
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 interfaceXMLEvent- See Also:
-
getPublicId
Description copied from interface:javax.xml.stream.LocationReturns the public ID of the XML- Specified by:
getPublicIdin interfaceLocation- Returns:
- the public ID, or null if not available
-
getSystemId
Description copied from interface:javax.xml.stream.LocationReturns the system ID of the XML- Specified by:
getSystemIdin interfaceLocation- Returns:
- the system ID, or null if not available
-
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 interfaceLocation- 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 interfaceLocation- 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 interfaceLocation- Returns:
- the current offset
-
setCharacterOffset
public void setCharacterOffset(int c) -
getLocationURI
-
setLocationURI
-
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 interfaceXMLEvent
-
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 interfaceXMLEvent
-
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 interfaceXMLEvent
-
recycle
public void recycle() -
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 interfaceXMLEvent
-
writeAsEncodedUnicode
Description 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 interfaceXMLEvent- Parameters:
writer- The writer that will output the data- Throws:
XMLStreamException
-
doWriteAsEncodedUnicode
protected abstract void doWriteAsEncodedUnicode(Writer writer) throws IOException, XMLStreamException Template method to be implemented by sub-classes.- Throws:
IOExceptionXMLStreamException
-
toString
-