commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Räss <>
Subject [jxpath] matching
Date Mon, 12 Jul 2004 14:09:20 GMT

I want to know whether a given object (or a Pointer?) matches an xpath 
expression. Let's say I have the following code:

Root root = ...;
JXPathContext context = JXPathContext.newContext(root);
Child child = root.getChild(2);


if (context.matches(child, "/child")) {
  // "/child" matches the given object 'child'

(It's just an example. The method matches would probably be located 
somehwere else (Pointer?).)

What I want to achieve is something similar as CSS does in HTML. That 
is, I want to assign attributes to certain parts of a tree (in my case, 
an object tree). Instead of using CSS selectors (that are not very 
intuitive...) I want to use xpath location paths as selectors.

So in my case, I want to have a stylesheet that looks like:

/child {
  foo: bar;

This would assign the foo attribute the value 'bar' to every 'child'.

Is this possible at the moment? I did not find anything. Have I missed 
something? I'm not too familiar with jxpath so I don't see how this 
could fit in. Any ideas?


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

View raw message