dev@jax-ws.java.net

XMLStreamReaderEx, XMLStreamWriterEx

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Thu, 15 Dec 2005 17:41:36 -0800

It occurred to me during the lunch :-) that maybe it's better if those
interfaces extend from XMLStreamReader and XMLStreamWriter respectively,
rather than the current approach.

So I propose that we make it:

public interface XMLStreamReaderEx extends XMLStreamReader {
     CharSequence getText() throws XMLStreamException;
}

The key is that then in the signature of Message/Header classes, we use
XMLStreamReader, not XMLStreamReaderEx. The contract is that if the
caller can provide XMLStreamReaderEx instead of XMLStreamReader, it
should do so, and if the callee can take advantage of XMLStreamReaderEx,
it should do so by downcasting.

Right now, the only consumer that can take advantage of this Ex version
is JAXB, and the only producer is FI and XOP. So it seems rather stupid
to require everyone else to learn about this extension of StAX, when
this can be made as a private contract between those three components.
The downcasting doesn't have to happen very often, so it shouldn't
affect performance, and in that way everyone else doesn't have to learn
about this new concept.

So I think everyone wins.

Any thoughts?

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com