Re: [xml] Obtaining xpath expression original value

Mmmm. The XPaths are dynamically compiled (i guess) since, they are used to
pass arguments to xsl extension functions.

I'll study testXPath.c


----- Original Message ----- 
From: "Daniel Veillard" <veillard redhat com>
To: "Agustín Villena" <avillena tutopia com>
Cc: <xml gnome org>
Sent: Friday, April 16, 2004 11:43 AM
Subject: Re: [xml] Obtaining xpath expression original value

On Fri, Apr 16, 2004 at 11:14:29AM -0400, Agustín Villena wrote:
    I'm using libxml2.6.2, Nad I'm working in a framework to easily
program xslt extensions in c++.

I'm trying to report if an argument is invalid (for example, if an xpath
expression returns a invalid type of argumnet, i.e. expecting one string and
receiving a subtree). Obtaining the original xpath expresion would be great
(for example: "/root/tree/firstnode is not of type boolean")(

void xslFunctionCallback(xmlXPathParserContextPtr ctxt, int nargs)

in libxml source code, two fields of xmlXPathParserContext struct would
have this info
const xmlChar *cur;   /* the current char being parsed */
const xmlChar *base;   /* the full expression */

Nevertheless, cur and base are always NULL...

I'm missing something important?

  Confusing... The XPath expression you're trying to examine comes from
stylesheet or is it something you dynamically compiled ?
  In the first case you can't find errors, if there is an error the
compilation will fail. You will get the element, andf you can lookup
the attribute hosting the expression.
  In the second case look at testXPath.c from the distribution it does
this kind of error reporting.


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]