views:

129

answers:

1

JDK 1.6 includes the capability for using FastInfoset web services via the JAX-WS API. The implementations of these are hidden deep inside com.sun.xml.internal, with package names designed to put the fear of god into any sensible java developer (e.g. com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser (which implements XMLStreamReader) and com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer (which implements XMLStreamWriter).

My understanding is that the use of these FastInfoset implementations is part of the internal JAX-WS content negotiation logic, and therefore not exposed to the public API. However, I want to make explicit use of the FastInfoset implementations, using their public STAX interfaces, and referably via a public factory class, rather than direct reference to these internal packages.

Does anyone know if this facility is available, perhaps via the standard STAX factories?

+1  A: 

XMLInputFactory and XMLOutputFactory seem plausible.

Each has three implementations in my environment, one of which is cxf (ruled-out), one from codehaus (ruled-out), the other is from the fast infoset package you are referring to.

I found this using Eclipse "References", because the javadoc doesn't include the "Use" section.

Bozho
But those factories will just give you back which implementation they think is best, you can't say "I want a FastInfoset implementation"... or can you?
skaffman
I think you cant - they use the static FactoryFinder.find method. But I think by default they should return what you need.
Bozho
Looks like I'll need to pass in the classname of the FastInfoset implementation when I use `XMLInputFactory.newFactory()`. It's not much better than instantiating it directly, but it's a step in the right direction.
skaffman
Seems there's a hilarious bug in Java6... the return type of `XmlOutputFactory.newFactory()` is `XmlInputFactory`. Great quality control on the API spec, there.
skaffman