aboutsummaryrefslogtreecommitdiffstats
path: root/xpath.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-09-24 14:13:13 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-09-24 14:13:13 +0000
commit118aed78f360f51d182770e62b251ef324707aa2 (patch)
tree7663107b890922ac71f466bc749f1f9dd45104c0 /xpath.c
parent7233615a61a3636d8354e4e62b5c041f5fe0cbaf (diff)
downloadandroid_external_libxml2-118aed78f360f51d182770e62b251ef324707aa2.tar.gz
android_external_libxml2-118aed78f360f51d182770e62b251ef324707aa2.tar.bz2
android_external_libxml2-118aed78f360f51d182770e62b251ef324707aa2.zip
fixed the data callback on transition functionality which was broken when
* xmlregexp.c: fixed the data callback on transition functionality which was broken when using the compact form * result/schemas/*: updated the results, less verbose, all tests pass like before * DOCBparser.c testAutomata.c testC14N.c testSchemas.c testThreads.c testXPath.c valid.c xinclude.c xmllint.c xmlregexp.c xmlschemas.c xmlschemastypes.c xpath.c python/libxml.c: removed a bunch of annoying warnings * xpath.c: try to provide better error report when possible Daniel
Diffstat (limited to 'xpath.c')
-rw-r--r--xpath.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/xpath.c b/xpath.c
index 333d2000..9aa8a3a5 100644
--- a/xpath.c
+++ b/xpath.c
@@ -67,7 +67,8 @@ static xmlNs xmlXPathXMLNamespaceStruct = {
NULL,
XML_NAMESPACE_DECL,
XML_XML_NAMESPACE,
- BAD_CAST "xml"
+ BAD_CAST "xml",
+ NULL
};
static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct;
#ifndef LIBXML_THREAD_ENABLED
@@ -249,6 +250,7 @@ struct _xmlXPathCompExpr {
int maxStep;
xmlXPathStepOp *steps; /* ops for computation */
int last;
+ xmlChar *expr;
#ifdef DEBUG_EVAL_COUNTS
int nb;
xmlChar *string;
@@ -330,6 +332,9 @@ xmlXPathFreeCompExpr(xmlXPathCompExprPtr comp)
xmlFree(comp->string);
}
#endif
+ if (comp->expr != NULL) {
+ xmlFree(comp->expr);
+ }
xmlFree(comp);
}
@@ -1285,17 +1290,22 @@ xmlXPatherror(xmlXPathParserContextPtr ctxt, ATTRIBUTE_UNUSED const char *file,
const xmlChar *cur;
const xmlChar *base;
-/* xmlGenericError(xmlGenericErrorContext,
- "Error %s:%d: %s\n", file, line,
- xmlXPathErrorMessages[no]);
-*/
- xmlGenericError(xmlGenericErrorContext,
- "Error %s\n", xmlXPathErrorMessages[no]);
-
cur = ctxt->cur;
base = ctxt->base;
- if ((cur == NULL) || (base == NULL))
+ if ((cur == NULL) || (base == NULL)) {
+ if ((ctxt->comp != NULL) && (ctxt->comp->expr != NULL)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "XPath error %s in %s\n", xmlXPathErrorMessages[no],
+ ctxt->comp->expr);
+ } else {
+ xmlGenericError(xmlGenericErrorContext,
+ "XPath error %s\n", xmlXPathErrorMessages[no]);
+ }
+
return;
+ }
+ xmlGenericError(xmlGenericErrorContext,
+ "XPath error %s\n", xmlXPathErrorMessages[no]);
while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
cur--;
@@ -10572,6 +10582,7 @@ xmlXPathCompile(const xmlChar *str) {
ctxt->comp = NULL;
}
xmlXPathFreeParserContext(ctxt);
+ comp->expr = xmlStrdup(str);
#ifdef DEBUG_EVAL_COUNTS
if (comp != NULL) {
comp->string = xmlStrdup(str);
@@ -10826,7 +10837,7 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) {
* returns "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles%23ocean"
*
*/
-void
+static void
xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr str;
int escape_reserved;