users@jaxb.java.net

Re: Binder and dom customization

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 07 Nov 2006 15:42:00 -0800

Petteri Stenius wrote:
> Hi,
>
> Some of my Java interfaces return DOM objects as the result of anyType wildcard mapping or DOM customization.
>
> If I'm unmarshalling with Binder from a DOM document instance then it would be very nice if the returned DOM objects belonged to the original DOM document instance.

Interseting. That would be nice indeed. Can you file an RFE for this in
http://jaxb.dev.java.net/issues/ ?

I think I might be able to do this.


> The following sample should make this request more clear. This is my schema fragment:
>
> <complexType name="RootType">
> <sequence>
> <element name="Wildcard">
> <annotation><appinfo><jaxb:dom/></appinfo></annotation>
> </element>
> </sequence>
> </complexType>
>
> The jaxb generated RootType interface defines an accessor method "Element getWildcard()".
>
> Now when I do this
>
> Document xml = documentBuilder.parse(input);
> Binder<Node> binder = jaxb.createBinder();
> RootType root = binder.unmarshal(xml, RootType.class).getValue();
> Element wildcard = root.getWildcard();
>
> What I'd like to see is root.getWildcard() return a DOM element from my original DOM instance. The following conditions for example should then be true:
> -- wildcard.getOwnerDocument() == xml
> -- wildcard.getParentNode() == binder.getXMLNode(root)
>
> An other option is to be able to use DOM elements as input to Binder.getXMLNode. Currently however getXMLNode returns null for DOM elements.
>
> Petteri
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com