Top Description Constructors Methods
org.codehaus.stax2.ri.evt

public Class Stax2EventAllocatorImpl

extends Object
implements XMLEventAllocator, XMLStreamConstants
Class Inheritance
All Implemented Interfaces
javax.xml.stream.XMLStreamConstants, javax.xml.stream.util.XMLEventAllocator
Imports
java.util.*, javax.xml.namespace.QName, .NamespaceContext, javax.xml.stream.*, javax.xml.stream.events.Attribute, .DTD, .EntityReference, .Namespace, .StartElement, .XMLEvent, javax.xml.stream.util.XMLEventAllocator, .XMLEventConsumer, org.codehaus.stax2.*, org.codehaus.stax2.ri.EmptyIterator

Base implementation of XMLEventAllocator, to be used either as is, or as a base for more specialized Stax2 event allocator implementation.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public XMLEvent
allocate(XMLStreamReader
The XMLStreamReader to allocate from
r
)

Implements javax.xml.stream.util.XMLEventAllocator.allocate.

This method allocates an event given the current state of the XMLStreamReader.
public void
allocate(XMLStreamReader
The XMLStreamReader to allocate from
r
,
XMLEventConsumer
The XMLEventConsumer to add to.
consumer
)

Implements javax.xml.stream.util.XMLEventAllocator.allocate.

This method allocates an event or set of events given the current state of the XMLStreamReader and adds the event or set of events to the consumer that was passed in. This method can be used to expand or contract reader states into event states.
protected DTD
protected EntityReference
protected StartElement
protected Location
getLocation(XMLStreamReader r)

Method used to get the Location object to use for an event to create.

public XMLEventAllocator
newInstance()

Implements javax.xml.stream.util.XMLEventAllocator.newInstance.

This method creates an instance of the XMLEventAllocator.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Stax2EventAllocatorImplback to summary
public Stax2EventAllocatorImpl()

Method Detail

allocateback to summary
public XMLEvent allocate(XMLStreamReader r) throws XMLStreamException

Implements javax.xml.stream.util.XMLEventAllocator.allocate.

Doc from javax.xml.stream.util.XMLEventAllocator.allocate.

This method allocates an event given the current state of the XMLStreamReader. If this XMLEventAllocator does not have a one-to-one mapping between reader states and events this method will return null. This method must not modify the state of the XMLStreamReader.

Parameters
r:XMLStreamReader

The XMLStreamReader to allocate from

Returns:XMLEvent

the event corresponding to the current reader state

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
allocateback to summary
public void allocate(XMLStreamReader r, XMLEventConsumer consumer) throws XMLStreamException

Implements javax.xml.stream.util.XMLEventAllocator.allocate.

Doc from javax.xml.stream.util.XMLEventAllocator.allocate.

This method allocates an event or set of events given the current state of the XMLStreamReader and adds the event or set of events to the consumer that was passed in. This method can be used to expand or contract reader states into event states. This method may modify the state of the XMLStreamReader.

Parameters
r:XMLStreamReader

The XMLStreamReader to allocate from

consumer:XMLEventConsumer

The XMLEventConsumer to add to.

Annotations
@Override
Exceptions
XMLStreamException:
if an error occurs
createDTDback to summary
protected DTD createDTD(XMLStreamReader r, Location loc) throws XMLStreamException
createEntityReferenceback to summary
protected EntityReference createEntityReference(XMLStreamReader r, Location loc) throws XMLStreamException
createStartElementback to summary
protected StartElement createStartElement(XMLStreamReader r, Location loc) throws XMLStreamException
getLocationback to summary
protected Location getLocation(XMLStreamReader r)

Method used to get the Location object to use for an event to create. Base implementation just calls stream reader's accessors, but sub-classes may choose to use other methods (esp. when not in "preserve location" mode).

newInstanceback to summary
public XMLEventAllocator newInstance()

Implements javax.xml.stream.util.XMLEventAllocator.newInstance.

Doc from javax.xml.stream.util.XMLEventAllocator.newInstance.

This method creates an instance of the XMLEventAllocator. This allows the XMLInputFactory to allocate a new instance per reader.

Returns:XMLEventAllocator

an instance of the XMLEventAllocator

Annotations
@Override