users@jaxb.java.net

Re: Unmarshalling via InputStream

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 25 Aug 2003 11:51:38 -0700

> I agree that the problem is in JAXP not JAXB. But since other solutions
> (DOMParser) do work, it is still a bug, no?

It is a bug of that DOMParser, not of JAXB. I agree that the way it
works sucks, but it's just beyond JAXB.


> Also, I don't think PI can exist after the end of the root tag, can
> they? I thought nothing could exist after the end of the root tag.

Exactly. The point is, a parser is *required* to check that nothing
follows after the root tag. This can be only done by reading everything
until EOF.



I think what you should have done is to re-define the network protocol.
For example, here's what's done in the Jabber protocol:

    1. a client sends the start tag of the root element to the server
    2. a server sends back the start tag of the root element
    3. each time a client/server wants to send a message, it sends
       one tree as a child of the root element.

In this way, your stream essentially becomes one never-ending XML
document. A SAX/pull parser can easily handle those situations, and so
does JAXB (granted, it might not be easy right now, but we can improve
that)


regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net