-
public interface XMLEventAllocator
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"- Since:
- 1.6
- See Also:
XMLInputFactory
,XMLEventFactory
-
-
Method Summary
Methods Modifier and Type Method and Description XMLEvent
allocate(XMLStreamReader reader)
This method allocates an event given the current state of the XMLStreamReader.void
allocate(XMLStreamReader reader, XMLEventConsumer 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.XMLEventAllocator
newInstance()
This method creates an instance of the XMLEventAllocator.
-
-
-
Method Detail
-
newInstance
XMLEventAllocator newInstance()
This method creates an instance of the XMLEventAllocator. This allows the XMLInputFactory to allocate a new instance per reader.
-
allocate
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
- The XMLStreamReader to allocate from- Returns:
- the event corresponding to the current reader state
- Throws:
XMLStreamException
-
allocate
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
- The XMLStreamReader to allocate fromconsumer
- The XMLEventConsumer to add to.- Throws:
XMLStreamException
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/xml/stream/util/xmleventallocator.html/
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.