2

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769

1 Answers1

2

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
  • 588,226
  • 146
  • 1,060
  • 1,140
  • 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 Jan 22 '10 at 15:27
  • I think you cant - they use the static FactoryFinder.find method. But I think by default they should return what you need. – Bozho Jan 22 '10 at 15:37
  • 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 Jan 22 '10 at 15:44
  • 1
    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 Jan 22 '10 at 16:04