commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg" <gre...@ozemail.com.au>
Subject AbstractFactory question v1.1b1
Date Mon, 10 Feb 2003 04:23:12 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message