Hi Dmitri

From: "Dmitri Plotnikov" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 01, 2001 3:50 PM
Subject: JXPath: use xpath to access JavaBeans


> Check out JXPath, a bridge between XPath and
> JavaBeans: http://www.plotnix.com/jxpath
>
> The basic idea is to use the XPath syntax to
> access/modify properties of java beans.  Normally
> XPath is applied to DOM trees. JXPath makes it work
> with graphs of JavaBeans, primitive types,
> collections, arrays and maps.

This is really cool. I had a similar idea recently and started a thread on
the jakarta-commons list.

http://www.mail-archive.com/jakarta-commons%40jakarta.apache.org/msg01460.ht
ml

I can see an XPath syntax expression language really useful across all JSP
tag libraries. Using a single XPath expression language to query across
DOM-ish trees (DOM, dom4j, JDOM, Electric XML etc.) or JavaBeans would be
really cool.

Right now I use a JSP tag library I wrote called xtags (http://xtags.org) to
style and format XML documents using XSLT-like tags and XPath expressions.
(Hopefully it will be added to the jakarta-taglibs project real soon now).
It is quite simple to build complex pages just using a just simple set of
tags and XPath expressions. It would be cool if a similar technique could be
done to query Java Beans as well as XML object models.

This could lead to an interesting prototyping technique. As you start
building your web-app write static XML documents to represent you 'bussiness
object models' state. Then use XPath and JSP custom tags to create the view
JSPs of your business objects that you need. That way you learn what
business object state you need in your XML document. Then you can turn the
static XML into real data either by generating the XML dynamically, or by
implementing a set of Java Beans which match the XPath expressions you need.
Another approach would be to use XSLT to style your existing Java Bean
business objects.

I notice that your JXPath implementation implements the DOM API as a proxy
so Java Beans can work with Xalan. This is a neat idea. Fancy donating it to
Jakarta? ;-)

I'd like to use JXPath to integrate into xtags so that xtags could work on
XML or Java Beans.

For a variety of reasons I'm also considering starting a "JPath" project
that does it the other way around - open up an existing XPath engine (say,
Xalan) and refactors the code such that more efficient bindings can be done
to say:-

    * DOM
    * Java Beans (Map, Collection, Arrays etc)
    * dom4j
    * JDOM
    * Electric XML

Certainly the dom4j and JDOM communities would also benefit from having a
native (say) Xalan's XPath engine bound to their object models, without
having to make intermediate DOM adapter objects. Having Java Beans bindings
would be really cool too. Would you be interested in getting involved in
that too, if ever it gets off the ground?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to