XMLEventAllocator (Java EE 5)

Java EE API


javax.xml.stream.util Interface XMLEventAllocator


public interface XMLEventAllocator


此接口定义了一个类,该类允许用户注册给定 XMLStreamReader 的情况下分配事件的方式。实现不需要使用 XMLEventFactory 实现,但推荐这样做。可以使用属性 "javax.xml.stream.allocator" 在 XMLInputFactory 上设置 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"

Version:
1.0
Author:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:
XMLInputFactory, XMLEventFactory

Method Summary
 XMLEvent
 void
 XMLEventAllocator
 

Method Detail

public XMLEventAllocator newInstance()
此方法创建一个 XMLEventAllocator 实例。它允许 XMLInputFactory 为每个 reader 分配一个新实例。
英文文档:

newInstance

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


public XMLEvent allocate(XMLStreamReader reader) throws XMLStreamException
此方法在给定 XMLStreamReader 当前状态的情况下分配事件。如果此 XMLEventAllocator 在 reader 状态和事件之间不存在一对一的映射关系,则此方法将返回 null。此方法不能修改 XMLStreamReader 的状态。
reader 作为分配根据的 XMLStreamReader
return 对应于当前 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

public void allocate(XMLStreamReader reader, XMLEventConsumer consumer) throws XMLStreamException
此方法在给定 XMLStreamReader 当前状态的情况下分配一个事件或一个事件组,并将该事件或事件组添加给传入的使用者。此方法可将 reader 状态展开或联系到事件状态中。此方法可修改 XMLStreamReader 的状态。
reader 作为分配根据的 XMLStreamReader
consumer 要添加事件的 XMLEventConsumer。
英文文档:

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 from
consumer - The XMLEventConsumer to add to.
Throws:
XMLStreamException


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!