I've recently rediscovered Jaxen and I love it!  

I was looking through the archives and found this:

http://www.mail-archive.com/jaxen-interest%40lists.sourceforge.net/msg00288.html

Proposing to unify JaXPath and BaseXPath, and also to make a "generic
XPath implementation".  I like both these suggestions and I'd be
willing to spend a little time refactoring to make it happen.

I'd propose that the base class itself be made generic.  IOW, 

* combine JaXPah and BaseXPath

* rename BaseXPath to XPath (yes, another object named XPath, sigh)

* make it introspect on the parameter to figure out what type of
Navigator to instantiate.

Then a user could just do

  new XPath(expr).selectNodes(doc)

where dom is either a DOM Document, or a JDOM document, or the
equivalent from dom4j or the other one...

without worrying about imports.

The introspecting could be isolated to a single function inside the
base object -- say, "Navigator getNavigatorForObject(Object)".

As a bonus, you could make the base XPath store the navigator in an
instance variable; this would remove one of the things I think is
weird about the API -- its use of inheritance instead of simple
delegation to support multiple Navigator types.

Anyway, not a huge deal, just thought I'd share my sense of design
aesthetics.  I look at the code and see too many wrappers.

 - Alex

-- 
Alex Chaffee                       mailto:[EMAIL PROTECTED]
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to