I used JXPath against POJOs for the Validator code that's curently
in a pending patch. There are three issue with it, AFACT:
- You have to define a top-level POJO representing "/". For example, if
I define "EjbJar" as my top bean for the ejb-jar.xml schema, then the
XPath /ejb-jar/enterprise-beans doesn't work, but if my top-level bean is
"EjbDocument" which has an "ejbJar" property, then the XPath works fine.
- You have to translate XML XPaths to POJO XPaths. For example,
/ejb-jar/enterprise-beans turns into /EjbJar/EnterpriseBeans
- There are a couple of areas where our POJOs don't strictly follow the
schema. For example, for method/method-params/method-param*, we have a
Method object with a String array called methodParam, instead of a Method
object with a MethodParams property with a String array called
methodParam.
Now, I think all of these adjustments are easy to make, and it was
extremely easy to code and debug the JXPath code, so I'm happy to go there
myself, but it isn't _quite_ as transparent as if we used XML XPaths on a
DOM directly or something like that.
Aaron
On Tue, 2 Sep 2003, John Rayburn wrote:
> Jan Bartel wrote:
> > Yes. I believe there is at least one Jakarta xpath-for-POJO project. I
>
> > don't have any experience with it and I was hoping someone on this
> list
> > might contribute their evaluation of it.
>
> JXpath does a great job of allowing XPath queries on POJOs and DOM
> objects. We've been using it for several different internal projects
> for several months now.