JAXB User wrote:
> How can I navigate from nodes in the DOM I get back from the
> Marshaller back to the JAXB binding instances?
You have to use Binder.unmarshal(domTree) to be able to get back to
associated DOM.
Here is pointer to javadoc for method you need to call.
https://jaxb.dev.java.net/nonav/jaxb20-pr/api/javax/xml/bind/Binder.html#getJAXBNode(XmlNode)
> I'd like to be able to evaluate an XPath against the DOM and then get
> back to the correct binding instance. The User Cases outlined in
> Section 4.8.1 mention being able to do this, but I can't figure out how.
> It also mentions using a binder.synchronize method to push back the
> changes.
Javadoc and specification are out of date. Updating specification to use
the actual
method that is referenced below.
https://jaxb.dev.java.net/nonav/jaxb20-pr/api/javax/xml/bind/Binder.html#updateXML(java.lang.Object)
> Are these features supported and can anyone point me to some samples
> that take advantage of them?
We do not have a sample for this scenario yet, but we will put one together
Known limitation in public review release:
The released version of Binder.unmarshal can only manipulate DOM parse
tree where its root element
corresponds with a global element declaration in the schema. So for
your case, your XPATH expression
would have to limit itself to finding xml elements that correspond to
global element declarations
in the schema (a global element declaration is one whose parent in the
schema is the schema object itself,
a local element declaration is one whose scope a complex type
definition.) The next release of JAXB will contain
a new method overloading of unmarshal methods in Binder and Unmarshaller
will take a declaredType parameter.
Thses overloading of the unmarshal method allow the application to state
how to unmarshal the root element of
the DOM parse tree by specifying the JAXB mapped class for the root
element. For example, if
the child element being unmarshalled has a type of xsd:string, the
declaredType would be java.lang.String.
-Joe Fialli, Sun Microsystems
> Thanks in advance for any help!
>
> Giac
>
> ------------------------------------------------------------------------
> Start your day with Yahoo! - make it your home page
> <http://us.rd.yahoo.com/evt=34442/*http://www.yahoo.com/r/hs>