You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Simon Räss <co...@gmx.ch> on 2004/07/12 16:09:20 UTC

[jxpath] matching

hi

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?

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org