Hi,

I'm using Jaxen with Jdom and Rhino (mozilla's javascript engine) and so far
I've been able to integrate Rhino scripts into Jdom elements. Now I want to
integrate Rhino and Jaxen, so XPath expressions can call Rhino functions.

I'm considering adding a rhino namespace, using the syntax for prefixed
function names,
e.g. thing[@location=rhino:currentLocation()]/name/text()
The idea is to automatically trap calls to functions that are prefixed with
rhino using a special FunctionContext, and call the appropriate Rhino
function by automatically generating Function objects. However, the example
above gives a Saxpath error stating that the '(' was unexpected. I've looked
at the Saxpath source and it seems to allow prefixed function names (see
code below), so does anyone know what's wrong, or perhaps this has been
fixed in a later release (my jar is dated 28.09.2001)?

Hallvard

>From XPathReader:

void functionCall() throws SAXPathException
    {
        String prefix       = null, functionName = null;

        if ( LA(2) == COLON ) {
            prefix = match( IDENTIFIER ).getTokenText();
            match( COLON );
        } else
            prefix = "";
        functionName = match( IDENTIFIER ).getTokenText();
        getXPathHandler().startFunction( prefix, functionName );
        match ( LEFT_PAREN );
        arguments();
        match ( RIGHT_PAREN );
        getXPathHandler().endFunction();
    }


Hallvard Trętteberg, stipendiat ved IDI, NTNU
http://www.idi.ntnu.no/~hal, mailto:[EMAIL PROTECTED], phone:+47 7359 3443


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to