All,

I'm trying to plug in a general purpose DOM AbstractFactory that will handle creation 
of elements/attributes as needed.


JXPathContext context = JXPathContext.newContext( myDomElement );

AbstractFactory factory = new MyJXPathDOMFactory();
context.setFactory(factory);
context.setLenient(true);

where myDomElement does contain <someElement> but not <fred> or @fred the following 
lines fail without calling my factory (which contains printlines to show where the 
createObject and declareVariable methods are called.

context.createPath( "//someElement/fred" );            // fails
context.createPath( "//someElement/@fred" );        // fails

I get the following exception:

JXPathExpression: Expression is not a path
at 
org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathJXPathContextReferenceImpl.java:361)


1. Is there a *simple* example floating around that in a few lines of code shows how a 
custom AbstractFactory is plugged into a JXPathContext using DOM?

2. Is there already an implementation of a general purpose DOM AbstractFactory 
available anywhere?

Thanks,
Greg.

Reply via email to