commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <>
Subject Re: [JXPath] Outline of creating a custom impl
Date Thu, 22 Apr 2004 00:12:59 GMT

JXPath's own support of a bunch of object models is comprised of different
implementations of the NodePointer and NodePointerFactory APIs.  Consider
following the same approach.  The job of NodePointerFactory is to recognize
the model it supports given an instance of that model. Basically, it answers
a question like "is this a JavaBean?", "is this a DOM node?". The job of
NodePointer is to represent a node in the model and provide iterators of
children, attributes (if any) and namespaces (if any).

Check out the implementations of those APIs in the
org.apache.jxpath.ri.model.* packages and see if any of them would provide a
convenient superclass for your custom model.

Once you have custom NodePointer and NodePointerFactory, register the
factory using the JXPathContextReferenceImpl.addNodePointerFactory() method.

Let me know how it works out.

- Dmitri

----- Original Message ----- 
From: "Dominique Devienne" <>
To: <>
Sent: Wednesday, April 21, 2004 12:00 PM
Subject: [JXPath] Outline of creating a custom impl

> I've used JXPath in the past to traverse XML documents, and I like it.
> Flexible and powerful.
> Recently though I've stumbled into a problem with Ant build files. Using
> new Ant 1.6 <import>, which I use liberally, the build is seldom anymore
> contained within a single XML document I could simply wrap in a
> DocumentContainer. So I'm thinking I could lay a custom JXPathContext
> implementation on top of the Ant model (Project / Targets / Tasks /
> RuntimeConfigurable) to be able to traverse that module *after* Ant has
> resolved all the imports, renames overriden targets, etc...
> Ant has a full in-memory model of the build files (which is a slight
> approximation of the actual XML nodes, but that's OK for me), so it seems
> reasonable to allow traversal of it using JXPath.
> Could someone outline the steps necessary to code such a custom pseudo-DOM
> tree traversal? The JXPath doc is very brief on what is really needed to
> something like that. Thanks, --DD
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message