users@jaxb.java.net

Re: Meaning of "traverse a graph of JavaBean objects" (JAXB 2.0)

From: <richard_barnett_at_mlc.com.au>
Date: Thu, 21 Aug 2003 09:31:42 +1000

Joseph Fialli <joseph.fialli_at_sun.com> wrote:

> richard_barnett_at_mlc.com.au wrote:
>
> >The JAXB 2.0 JSR <http://jcp.org/en/jsr/detail?id=222> says:
>
> >"Portable mechanisms to traverse a graph of JavaBean objects will be
> >addressed in JAXB 2.0."
>
> "Portable mechanisms include but are not limited to the the use of XPath
> expressions."
>
> Another mechanism that I remember being considered was the visitor pattern.

Visitor pattern or XPath extraction would both be fine for my purposes.

The "Iterating Through Content Tree" thread (John Tracy & Kohsuke) on
14th August was also interesting -- I'll look at JXPath.

> >Does this mean that a JAXB object will expose an iterator over its child
> >(or descendant) JAXB objects?
> >
> >If so, will it be possible to iterate over attributes?
>
> Using XPath extraction, you could get this infoset view of the
> data w/o requiring XML InfoSet specific methods(getAttributes() or
> getChildren()) being generated in every JAXB interface.

This is a good point.

> >Will this introduce child->parent links?
>
> DOM already provides this relationship. JAXB 1.0 databinding
> desired to avoid requiring the storage/processing overhead and
> implementation complexities caused by maintaining child->parent
> links in its Java representation of XML content for ALL JAXB
> implementations.

I'd prefer not to have to go to DOM for the iteration or the
child->parent links.

(Without child->parent links how will you support all XPath axes?)

I wanted the links in order to provide better location information in
the event of a validation exception. However, I can use
xjc:superClass to give each generated with a 'parent' property.

Thanks

-- Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net