Skip to main content
Submitted by Xenoveritas on

I'm glad to see the Java StAX documentation is proffread - because it certainly isn't proofread.

Two examples are below, one from XMLStreamReader, and another from XMLOutputFactory.

From the Java 1.6 documentation for XMLStreamReader.nextTag():

Essentially it does the following (implementations are free to optimized but must do equivalent processing):

int eventType = next();
while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
|| (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
// skip whitespace
|| eventType == XMLStreamConstants.SPACE
|| eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
|| eventType == XMLStreamConstants.COMMENT
) {
eventType = next();
if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
throw new String XMLStreamException("expected start or end tag", getLocation());
return eventType;

So, basically, it must fail to compile?


Next we have XMLOutputFactory.newInstance(String, ClassLoader). The documentation speaks for itself:

Deprecated. This method has been deprecated because it returns an instance of XMLInputFactory, which is of the wrong class. Use the new method newFactory(java.lang.String, java.lang.ClassLoader) instead.

Go copy-and-paste coders!