下面列出了怎么用javax.xml.stream.util.XMLEventAllocator的API类实例代码及写法,或者点击链接到github查看源代码。
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public StAXEventReader(XMLStreamReader reader) throws XMLStreamException {
_streamReader = reader ;
_eventAllocator = (XMLEventAllocator)reader.getProperty(XMLInputFactory.ALLOCATOR);
if(_eventAllocator == null){
_eventAllocator = new StAXEventAllocatorBase();
}
//initialize
if (_streamReader.hasNext())
{
_streamReader.next();
_currentEvent =_eventAllocator.allocate(_streamReader);
events[0] = _currentEvent;
hasEvent = true;
} else {
throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.noElement"));
}
}
public WstxEventReader(XMLEventAllocator a, XMLStreamReader2 r)
{
mAllocator = a;
mReader = r;
mCfgMultiDocMode = (r instanceof StreamScanner)
&& ((StreamScanner) r).getConfig().inputParsingModeDocuments();
}
@Override
public void setProperty(String propName, Object value)
{
if (!mConfig.setProperty(propName, value)) {
if (XMLInputFactory.ALLOCATOR.equals(propName)) {
setEventAllocator((XMLEventAllocator) value);
}
}
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
public void setAllocator(XMLEventAllocator allocator) {
if (allocator == null)
throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullXMLEventAllocator"));
_eventAllocator = allocator;
}
/** Set a user defined event allocator for events
* @param allocator the user defined allocator
*/
public void setEventAllocator(XMLEventAllocator allocator) {
fPropertyManager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
/** Set a user defined event allocator for events
* @param allocator the user defined allocator
*/
public void setEventAllocator(XMLEventAllocator allocator) {
fPropertyManager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
}
public javax.xml.stream.util.XMLEventAllocator newInstance() {
return new XMLEventAllocatorImpl();
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
public void setAllocator(XMLEventAllocator allocator) {
if (allocator == null)
throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullXMLEventAllocator"));
_eventAllocator = allocator;
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
/** Set a user defined event allocator for events
* @param allocator the user defined allocator
*/
public void setEventAllocator(XMLEventAllocator allocator) {
fPropertyManager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
}
/** Set a user defined event allocator for events
* @param allocator the user defined allocator
*/
public void setEventAllocator(XMLEventAllocator allocator) {
_manager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
/** Set a user defined event allocator for events
* @param allocator the user defined allocator
*/
public void setEventAllocator(XMLEventAllocator allocator) {
_manager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
}
public void setAllocator(XMLEventAllocator allocator) {
if (allocator == null)
throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullXMLEventAllocator"));
_eventAllocator = allocator;
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}
/** Set a user defined event allocator for events
* @param allocator the user defined allocator
*/
public void setEventAllocator(XMLEventAllocator allocator) {
fPropertyManager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
}
public javax.xml.stream.util.XMLEventAllocator newInstance() {
return new XMLEventAllocatorImpl();
}
public javax.xml.stream.util.XMLEventAllocator newInstance() {
return new XMLEventAllocatorImpl();
}
public XMLEventAllocator getEventAllocator() {
return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
}