APIdia Launch Partner
Top Description Fields Methods
javax.xml.stream.events

public Interface XMLEvent

extends XMLStreamConstants
Known Direct Subinterfaces
javax.xml.stream.events.Attribute, javax.xml.stream.events.Characters, javax.xml.stream.events.Comment, javax.xml.stream.events.DTD, javax.xml.stream.events.EndDocument, javax.xml.stream.events.EndElement, javax.xml.stream.events.EntityDeclaration, javax.xml.stream.events.EntityReference, javax.xml.stream.events.NotationDeclaration, javax.xml.stream.events.ProcessingInstruction, javax.xml.stream.events.StartDocument, javax.xml.stream.events.StartElement
Known Direct Implementers
com.sun.xml.internal.stream.events.DummyEvent
Imports
java.io.Writer, javax.xml.namespace.QName

This is the base event interface for handling markup events. Events are value objects that are used to communicate the XML 1.0 InfoSet to the Application. Events may be cached and referenced after the parse has completed.
Author
Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
Since
1.6
Version
1.0
See Also
javax.xml.stream.XMLEventReader, Characters, ProcessingInstruction, StartElement, EndElement, StartDocument, EndDocument, EntityReference, EntityDeclaration, NotationDeclaration

Field Summary

Inherited from javax.xml.stream.XMLStreamConstants:
ATTRIBUTECDATACHARACTERSCOMMENTDTDEND_DOCUMENTEND_ELEMENTENTITY_DECLARATIONENTITY_REFERENCENAMESPACENOTATION_DECLARATIONPROCESSING_INSTRUCTIONSPACESTART_DOCUMENTSTART_ELEMENT

Method Summary

Modifier and TypeMethod and Description
public Characters

Returns:

a Characters event
asCharacters
()

Returns this event as Characters, may result in a class cast exception if this event is not Characters.

public EndElement

Returns:

a EndElement event
asEndElement
()

Returns this event as an end element event, may result in a class cast exception if this event is not a end element.

public StartElement

Returns:

a StartElement event
asStartElement
()

Returns this event as a start element event, may result in a class cast exception if this event is not a start element.

public int

Returns:

the event type
getEventType
()

Returns an integer code for this event.

public Location

Returns:

the location of the event
getLocation
()

Return the location of this event.

public QName

Returns:

the type of the event, null if not available
getSchemaType
()

This method is provided for implementations to provide optional type information about the associated event.

public boolean

Returns:

true if the event is Attribute, false otherwise
isAttribute
()

A utility function to check if this event is an Attribute.

public boolean

Returns:

true if the event is Characters, false otherwise
isCharacters
()

A utility function to check if this event is Characters.

public boolean

Returns:

true if the event is EndDocument, false otherwise
isEndDocument
()

A utility function to check if this event is an EndDocument.

public boolean

Returns:

true if the event is EndElement, false otherwise
isEndElement
()

A utility function to check if this event is a EndElement.

public boolean

Returns:

true if the event is EntityReference, false otherwise
isEntityReference
()

A utility function to check if this event is an EntityReference.

public boolean

Returns:

true if the event is Namespace, false otherwise
isNamespace
()

A utility function to check if this event is a Namespace.

public boolean

Returns:

true if the event is ProcessingInstruction, false otherwise
isProcessingInstruction
()

A utility function to check if this event is a ProcessingInstruction.

public boolean

Returns:

true if the event is StartDocument, false otherwise
isStartDocument
()

A utility function to check if this event is a StartDocument.

public boolean

Returns:

true if the event is StartElement, false otherwise
isStartElement
()

A utility function to check if this event is a StartElement.

public void
writeAsEncodedUnicode(Writer
The writer that will output the data
writer
)

This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.

Method Detail

asCharactersback to summary
public Characters asCharacters()

Returns this event as Characters, may result in a class cast exception if this event is not Characters.

Returns:Characters

a Characters event

asEndElementback to summary
public 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.

Returns:EndElement

a EndElement event

asStartElementback to summary
public 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.

Returns:StartElement

a StartElement event

getEventTypeback to summary
public int getEventType()

Returns an integer code for this event.

Returns:int

the event type

See Also
START_ELEMENT, END_ELEMENT, CHARACTERS, ATTRIBUTE, NAMESPACE, PROCESSING_INSTRUCTION, COMMENT, START_DOCUMENT, END_DOCUMENT, DTD
getLocationback to summary
public Location getLocation()

Return the location of this event. The Location returned from this method is non-volatile and will retain its information.

Returns:Location

the location of the event

See Also
javax.xml.stream.Location
getSchemaTypeback to summary
public 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.

Returns:QName

the type of the event, null if not available

isAttributeback to summary
public boolean isAttribute()

A utility function to check if this event is an Attribute.

Returns:boolean

true if the event is Attribute, false otherwise

See Also
Attribute
isCharactersback to summary
public boolean isCharacters()

A utility function to check if this event is Characters.

Returns:boolean

true if the event is Characters, false otherwise

See Also
Characters
isEndDocumentback to summary
public boolean isEndDocument()

A utility function to check if this event is an EndDocument.

Returns:boolean

true if the event is EndDocument, false otherwise

See Also
EndDocument
isEndElementback to summary
public boolean isEndElement()

A utility function to check if this event is a EndElement.

Returns:boolean

true if the event is EndElement, false otherwise

See Also
EndElement
isEntityReferenceback to summary
public boolean isEntityReference()

A utility function to check if this event is an EntityReference.

Returns:boolean

true if the event is EntityReference, false otherwise

See Also
EntityReference
isNamespaceback to summary
public boolean isNamespace()

A utility function to check if this event is a Namespace.

Returns:boolean

true if the event is Namespace, false otherwise

See Also
Namespace
isProcessingInstructionback to summary
public boolean isProcessingInstruction()

A utility function to check if this event is a ProcessingInstruction.

Returns:boolean

true if the event is ProcessingInstruction, false otherwise

See Also
ProcessingInstruction
isStartDocumentback to summary
public boolean isStartDocument()

A utility function to check if this event is a StartDocument.

Returns:boolean

true if the event is StartDocument, false otherwise

See Also
StartDocument
isStartElementback to summary
public boolean isStartElement()

A utility function to check if this event is a StartElement.

Returns:boolean

true if the event is StartElement, false otherwise

See Also
StartElement
writeAsEncodedUnicodeback to summary
public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException

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.

Parameters
writer:Writer

The writer that will output the data

Exceptions
XMLStreamException:
if there is a fatal error writing the event