On Thu, 2006-02-09 at 21:52 -0800, Craig McClanahan wrote:
No. None of the rule-matching implementations support XPath
expressions.
It would also likely require some pretty fundamental architectural
changes, since Digester uses a SAX parser underneath the covers (and
never has access to a data structure representing the entire
document). XPath queries seem much more appropriate when you've got
the whole DOM of the document to examine.
Well, I agree that supporting XPath in general is not possible with
Digester, which is fundamentally based on SAX while XPath is
fundamentally based on DOM.
However for the specific case in question, which is matching based on
attribute values, is it really impossible to provide that functionality
in some form? When the opening tag of the element is encountered, the
attributes are also provided, so I believe it's possible in principle to
fire methods for rules based on attribute values while still using SAX.
I agree that adding it to the existing digester 1.x implementation is
not feasable because the existing Rules class API doesn't pass this
info; adding this would break all existing Rules classes which isn't
reasonable. However I don't see why a digester2 project couldn't
redesign things to make this possible. Am I missing something? I was
certainly planning on adding this sort of functionality to digester2 (if
I ever find time to resume work on it). In particular, I was interested
in looking at STX (http://stx.sourceforge.net/) rather than xpath as
inspiration, as I believe the STX expression functionality doesn't rely
on having a DOM around...
Cheers,
Simon
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]