APIdia Launch Partner
Top Description Methods
javax.xml.stream.util

public Interface XMLEventAllocator

Known Direct Implementers
com.sun.xml.internal.stream.events.XMLEventAllocatorImpl
Imports
javax.xml.stream.events.XMLEvent, javax.xml.stream.XMLStreamReader, .XMLStreamException

This interface defines a class that allows a user to register a way to allocate events given an XMLStreamReader. An implementation is not required to use the XMLEventFactory implementation but this is recommended. The XMLEventAllocator can be set on an XMLInputFactory using the property "javax.xml.stream.allocator"
Author
Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
Since
1.6
Version
1.0
See Also
javax.xml.stream.XMLInputFactory, javax.xml.stream.XMLEventFactory

Method Summary

Modifier and TypeMethod and Description
public XMLEvent

Returns:

the event corresponding to the current reader state
allocate
(XMLStreamReader
The XMLStreamReader to allocate from
reader
)

This method allocates an event given the current state of the XMLStreamReader.

public void
allocate(XMLStreamReader
The XMLStreamReader to allocate from
reader
,
XMLEventConsumer
The XMLEventConsumer to add to.
consumer
)

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.

public XMLEventAllocator

Returns:

an instance of the XMLEventAllocator
newInstance
()

This method creates an instance of the XMLEventAllocator.

Method Detail

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

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
reader:XMLStreamReader

The XMLStreamReader to allocate from

Returns:XMLEvent

the event corresponding to the current reader state

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

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
reader:XMLStreamReader

The XMLStreamReader to allocate from

consumer:XMLEventConsumer

The XMLEventConsumer to add to.

Exceptions
XMLStreamException:
if an error occurs
newInstanceback to summary
public 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