> (James-- I'm going to try moving all development discussion
> to the list, so we get searchable archives.)

Good idea!

> Since we're heading down the properties path for setting
> defaults, and having Navigator implementations named
> simply 'Navigator',

I'm not too concerned over the name, so long as it differs from the
org.jaxen.Navigator name - so DocumentNavigator or NavigatorImpl or
ModelNavigator or something. Using the same name (but a different package)
for each implementation seems a reasonable idea.


> Navigator nav = new org.jaxen.dom4j.Navigator();
>
> Which, to my eyes, is kinda ugly.

Agreed.


> Thus, maybe a NavigatorFactory, which builds up the classname of
> org.jaxen.<model_name.toLowerCase()>.Navigator, and instantiaties it:
>
> Navigator nav = NavigatorFactory.createNavigator( "dom4j" );
>
> You could still instantiate directly, as the first example.

Cute.

> Plus, I could see this aiding in building a single test-suite that
> is parameterized by a model-name to test out each model's Navigator.

Agreed - though its probably easiest to just have a generic test harness per
model which takes its data from common XML documents, as the model has to be
created as well. e.g. the dom4j Document, the JDOM Document etc.



> And while we're talking names, I've come to realize that the
> Navigator does indeed navigate, but it also inspects nodes for
> names, namespaces, etc.  Basically, it seems, rather to me,
> to be more broadly categorized as InfoSetAdaptor, since it's
> actually providing access to things specified by the XML
> InfoSet specification.
>
> Since it's a fairly broad functionality, no longer specific
> to Jaxen's navigation of nodes, maybe rename Navigator to
> InfoSetAdaptor.  And InfoSetAdaptorFactory.


Its certainly more accurate.  I originally thought ModelAdapter was a
reasoable name but then it can get a bit of a mouthful - I like trying to
keep the names of classes as simple as possible.


> InfoSetAdaptorFactory could also potentially have some
> magic to figure out, based upon a passed in node, which
> adaptor to provide:
>
> Document doc = buildSomeDocument();
>
> // *We* know that doc is an org.dom4j.Document, but..
>
> InfoSetAdaptor adaptor = InfoSetAdaptorFactory.getAdaptor( doc );
>
> ---
>
> public static InfoSetAdaptor getAdaptor(Object node)
> {
> Package pkg = node.getClass().getPackage();
>
> if ( pkg.getName().startsWith( "org.dom4j." ) )
> {
> return getAdaptor( "dom4j" );
> }
> }
>
> etc..
>
> Of course, could design for run-time registration of Adaptors, etc.

I like this idea. I've been thinking along similar lines - I'd like
'MasterNavigator' or CompositeInfoSetAdapter or whatever we call it to know
what are the default adapters to use for all the common models (beans, DOM,
dom4j, EXML, JDOM) then choose the best one based on the type of the object.

Then we could use jaxen without any model specific information. e.g.

Object object = ..; // could be dom4j, DOM, JDOM or whatever
JaXPath xpath = new MasterXPath( "//foo" );
List list = xpath.selectNodes( object );

James


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


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

Reply via email to