how to get an instance of an XMLEventAllocator?
- by kostja
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.