how to get an instance of an XMLEventAllocator?

Posted by kostja on Stack Overflow See other posts from Stack Overflow or by kostja
Published on 2010-12-23T12:40:21Z Indexed on 2010/12/23 17:54 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

I am trying to follow the recommended way of parsing XML with StAX using sun's Cursor-to-Event Example for Java EE 5. You are supposed to traverse the XML via the Cursor API and allocate an XMLEventusing an XMLEventAllocator when necessary.


Awkwardly, sun's own example does not compile (at least not with JDK 1.6, even with 1.5 code compliance). The example tries to instantiate an allocator via new, but the according implementation classes in the JDK are not accessible externally.


After reading the JavaDocs and searching the web I have found literally nothing.


One could implement the XMLEventAllocator interface from scratch, but it seems really wrong, when there are perfectly good implementations in the JDK, besides not being an expert in StAX makes it difficult to get it right.

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml