commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitri Plotnikov <dplot...@yahoo.com>
Subject Re: [JXPath] evaluating expression on a given node
Date Thu, 20 Feb 2003 22:56:35 GMT
Christian,

--- Christian Sell <christian.sell@netcologne.de> wrote:
> Dmitri Plotnikov wrote:
> > Of course you are welcome to look at the source code.  But I would
> > really appreciate it if you told me what it was that you were
> looking
> > there for. Such feedback would allow me to improve the
> documentation.
> 
> Ok. My conclusion so far is that my initial idea of being able to 
> determine on-the-fly (during parsing) for a given node whether it is 
> covered by a xpath expression does not work. This is because the 
> expression may be referencing items that come come later in the parse
> 
> (e.g., child nodes). Therefore I have to have two passes - one to
> build 
> the node tree, and another one to determine the target nodes for the 
> xpath expressions and treat them accordingly (e.g., set color "red").
> 
> This reduces my problem to being able to work on a custom object
> model. 
> I know JXPath supports this - but It seems that Jaxen is
> significantly 
> easier to extend - in fact, I had to implement only one class 
> (DocumentNavigator), and 2 helper classes. This also includes one 
> extension function.
> 
> also, with Jaxen I was able to easily separate the core functionality
> 
> together with my model support classes without carrying the other
> models 
> around unnecessarily.
> 
> Conclusion: I'll probably stick with Jaxen for now - unless it 
> completely breaks in the process. BTW, can you name any significant 
> advantages JXPath has over Jaxen? To me they seem to be almost
> identical 
> in function.
There are some differences, but generally speaking you are right - they
are similar in function.  JXPath supports mixed models, including
JavaBeans, Maps and Collections out of the box, Jaxen requires
customization for that. Jaxen has a simpler architecture. 

If you need to introduce a custom model (as you apparently do), you
take a different approach with Jaxen and JXPath, but I think you pretty
much have to do the same amount of work.  In Jaxen you implement
DocumentNavigator and a bunch of iterators, in JXPath you implement
NodePointerFactory and NodePointer - it's pretty much a wash.  Also, if
you can use custom BeanInfo, the JXPath customization is cheaper.

Jaxen is a fantastic product, JXPath is not too shabby either if I can
say so myself - so it's really a matter of preference.

> >>>>BTW, any hints on how to build JXPath from cvs? I am getting lots
> >>
> >>of
> >>
> >>>>test failures, and maven.log is full of error messages about
> >>
> >>invalid
> >>
> >>>>uses of Jelly tags.
> >>>
> >>>If you are having problems with the Maven build, try the regular
> >>
> >>Ant build -
> >>
> >>>it works like a charm.
> >>
> >>what makes me feel uncomfortable is the test failures I see all
> over
> >>the 
> >>place:
> > 
> > The test failures are caused by a minor issue with Maven where in
> > certain version of Maven it does not copy test resources into the
> > test_classes tree properly.  In order to get the tests run with
> Maven I
> > typically copy that resource by hand.  But like I said, the Ant
> build
> > including the tests works just fine.
> > 
> > - Dmitri
> 
> hmm, I think I had the same happening with ant..
I have never seen this with Ant.  Build "clean,test" and the result
should be fine.

> thanks,
> Christian

- Dmitri



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

Mime
View raw message