users@jaxb.java.net

Re: JAXB generated Java Model + JXPath

From: Prashant <prashant_at_pramati.com>
Date: Wed, 03 Aug 2005 17:01:09 +0530

A quick search of the archives reveals that this topic to be discussed
quite a bit. :)

Joe Fialli 's comment seems to be the last word on this (?)

https://jaxb.dev.java.net/servlets/ReadMsg?listName=users&msgNo=566

JAXB 2.0 Spec Proposes :

"In JAXB 1.0, the schema derived interfaces are close to JavaBean
properties. 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."

Any other ideas ?

Thank you.
-Prashant

> Hello:
>
> I would like to select instances from the JXAB generated Java Bean
> Tree by passing XPath.
>
> JXPath, an Apache's project allow exactly that.
>
> E.g:
>
> Address address = (Address)JXPathContext.newContext(vendor).
> getValue("locations[address/zipCode='90210']/address");
>
>
>
> Unfortunately JXPath's capabilites are limited to querrying a Java
> Bean Model which will fail even on moderately customized JAXB
> generated Java Bean Tree.
>
> /some-root/class is actually SomeRoot/Klass and so on.
>
> To extend JXPath
> <http://jakarta.apache.org/commons/jxpath/users-guide.html#Custom%20Pointers%20and%20Iterators>
> and seamlessly operate between XPath and JAXB's Java Bean Tree :
>
> 1. I would need to be aware of all the customizations "xjc" makes
> while generating the Java sources.
>
> What is a beatiful way to get this information ?
>
> Setup: JAXB RI 1.0.5, XPath 1.2
>
> Thanks
> -Prashant