[libxml2] fix schema validation in combination with xsi:nil



commit c100e69c4b4be13ba760eda45f72165e684c483f
Author: Daniel Veillard <veillard redhat com>
Date:   Thu Feb 28 19:02:32 2013 +0800

    fix schema validation in combination with xsi:nil
    
    Based on Thomas Gamper <icicle cg tuwien ac at> findings and
    initial patch
    
    There is no point doing a regexp validation of further
    content if there actually is no further content because the
    element is nilled.

 xmlschemas.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/xmlschemas.c b/xmlschemas.c
index d6a47e4..a08813d 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -26063,6 +26063,20 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
                    "AUTOMATON create on '%s'\n", inode->localName);
 #endif
            }
+
+           /*
+            * Do not check further content if the node has been nilled
+            */
+           if (INODE_NILLED(inode)) {
+               ret = 0;
+#ifdef DEBUG_AUTOMATA
+               xmlGenericError(xmlGenericErrorContext,
+                   "AUTOMATON succeeded on nilled '%s'\n",
+                   inode->localName);
+#endif
+                goto skip_nilled;
+           }
+
            /*
            * Get hold of the still expected content, since a further
            * call to xmlRegExecPushString() will loose this information.
@@ -26100,6 +26114,9 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
 
        }
     }
+
+skip_nilled:
+
     if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS)
        goto end_elem;
 


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