users@jaxb.java.net

Re: Tag name not allowed... but the same tag-name is in allowed set?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 16 Jun 2003 07:49:29 -0700

I'm sorry for this confusing error message, but I think you got the namespace
URI wrong in your document.


> This leads me to something I've been thinking about lately.
> It would be nice if there were some "update" hooks in JAXB
> that were more friendly to updating parts of documents and
> node-structures. In my example above, I want to unmarshall
> one part of a document and then update it back. Of course I
> can do this, but it requires nothing short of loading the
> whole DOM into memory, and seeking to that node myself for
> manipulation.

Take a look at the partial-unmarshal example. Also, combining JAXB with
upcoming StAX (JSR-173) would probably lets you do this fairly easily.

If you want to try that today, go to http://www.xmlpull.org

The idea is that you read through a pull-parser (or SAX events) and send
them to the writer, and when you hit the real meat, you bind that region
to JAXB, do the processing, write them back, then you copy the rest of
the input to the output.

Given the number of questions on this topic, perhaps this might deserve
its own sample.


> What if JAXB allowed unmarshalling and marshalling methods
> to specify XPath expressions to try to either find an
> unmarshallable object at, or to write an marshallable
> object to (replacing an existing instance, or updating it).
> Is this very possible with the current RI? Is anybody else
> thinking about it? Thanks!

Using XPath would rob the whole point since it requires a whole document
to be present on memory.


--
Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>