[libxml2] Add a forbidden variable error number and message to XPath



commit 47881284aeaeeb93b3444419adeffc9e11ed1093
Author: Daniel Veillard <veillard redhat com>
Date:   Fri Sep 7 14:24:50 2012 +0800

    Add a forbidden variable error number and message to XPath
    
    Related to https://bugzilla.gnome.org/show_bug.cgi?id=680938
    
    When the XML_XPATH_NOVAR flags is being used it means that
    variables are forbidden, not that they are missing

 include/libxml/xpath.h |    3 ++-
 xpath.c                |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
index ddd9dd8..3a5ca02 100644
--- a/include/libxml/xpath.h
+++ b/include/libxml/xpath.h
@@ -69,7 +69,8 @@ typedef enum {
     XPATH_ENCODING_ERROR,
     XPATH_INVALID_CHAR_ERROR,
     XPATH_INVALID_CTXT,
-    XPATH_STACK_ERROR
+    XPATH_STACK_ERROR,
+    XPATH_FORBID_VARIABLE_ERROR
 } xmlXPathError;
 
 /*
diff --git a/xpath.c b/xpath.c
index 2bb6d34..6552e1b 100644
--- a/xpath.c
+++ b/xpath.c
@@ -328,6 +328,7 @@ static const char *xmlXPathErrorMessages[] = {
     "Char out of XML range\n",
     "Invalid or incomplete context\n",
     "Stack usage errror\n",
+    "Forbidden variable\n",
     "?? Unknown error ??\n"	/* Must be last in the list! */
 };
 #define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) /	\
@@ -10378,7 +10379,7 @@ xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) {
 	           name, prefix);
     SKIP_BLANKS;
     if ((ctxt->context != NULL) && (ctxt->context->flags & XML_XPATH_NOVAR)) {
-	XP_ERROR(XPATH_UNDEF_VARIABLE_ERROR);
+	XP_ERROR(XPATH_FORBID_VARIABLE_ERROR);
     }
 }
 



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