Commit c7612996 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

improved the behaviour a bit as well as the logs fixed a few more bugs

* check-xml-test-suite.py: improved the behaviour a bit as
  well as the logs
* parser.c valid.c SAX.c: fixed a few more bugs
  "Ran 1819 tests: 1778 suceeded, 41 failed, and 0 generated an error"
Daniel
parent bb7ddb34
Sun Feb 17 23:45:40 CET 2002 Daniel Veillard <daniel@veillard.com>
* check-xml-test-suite.py: improved the behaviour a bit as
well as the logs
* parser.c valid.c SAX.c: fixed a few more bugs
"Ran 1819 tests: 1778 suceeded, 41 failed, and 0 generated an error"
Sun Feb 17 20:41:37 CET 2002 Daniel Veillard <daniel@veillard.com>
* check-xml-test-suite.py: python script to run regression tests
......
......@@ -479,6 +479,7 @@ attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
elem, fullname, type, def, defaultValue);
#endif
name = xmlSplitQName(ctxt, fullname, &prefix);
ctxt->vctxt.valid = 1;
if (ctxt->inSubset == 1)
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
name, prefix, (xmlAttributeType) type,
......@@ -493,7 +494,8 @@ attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
"SAX.attributeDecl(%s) called while not in subset\n", name);
return;
}
/* if (attr == 0) ctxt->valid = 0; */
if (ctxt->vctxt.valid == 0)
ctxt->valid = 0;
if (ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
......@@ -892,10 +894,25 @@ attribute(void *ctx, const xmlChar *fullname, const xmlChar *value)
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
0,0,0);
ctxt->depth--;
if (val == NULL)
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
ctxt->myDoc, ctxt->node, ret, value);
else {
xmlChar *nvalnorm;
/*
* Do the last stage of the attribute normalization
* It need to be done twice ... it's an extra burden related
* to the ability to keep references in attributes
*/
nvalnorm = xmlValidNormalizeAttributeValue(ctxt->myDoc,
ctxt->node, fullname, val);
if (nvalnorm != NULL) {
xmlFree(val);
val = nvalnorm;
}
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
ctxt->myDoc, ctxt->node, ret, val);
xmlFree(val);
......
......@@ -17,10 +17,17 @@ log = open(LOG, "w")
# Error and warning handlers
#
error_nr = 0
error_msg = ''
def errorHandler(ctx, str):
global error_nr
global error_msg
error_nr = error_nr + 1
if len(error_msg) < 300:
if len(error_msg) == 0 or error_msg[-1] == '\n':
error_msg = error_msg + " >>" + str
else:
error_msg = error_msg + str
libxml2.registerErrorHandler(errorHandler, None)
......@@ -56,9 +63,11 @@ def loadNoentDoc(filename):
def testNotWf(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
......@@ -75,9 +84,11 @@ def testNotWf(filename, id):
def testNotWfEnt(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
......@@ -95,10 +106,11 @@ def testNotWfEnt(filename, id):
def testNotWfEntDtd(filename, id):
global error_nr
global error_msg
global log
error = ''
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
......@@ -117,10 +129,11 @@ def testNotWfEntDtd(filename, id):
def testWfEntDtd(filename, id):
global error_nr
global error_msg
global log
error = ''
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
......@@ -144,9 +157,11 @@ def testWfEntDtd(filename, id):
def testInvalid(filename, id):
global error_nr
global error_msg
global log
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
......@@ -176,8 +191,10 @@ def testInvalid(filename, id):
def testValid(filename, id):
global error_nr
global error_msg
error_nr = 0
error_msg = ''
ctxt = libxml2.createFileParserCtxt(filename)
if ctxt == None:
......@@ -213,6 +230,7 @@ def runTest(test):
global test_failed
global test_error
global test_succeed
global error_msg
global log
uri = test.prop('URI')
......@@ -269,11 +287,17 @@ def runTest(test):
# Log the ontext
if res != 1:
log.write(" File: %s\n" % (URI))
content = test.content
content = string.strip(test.content)
while content[-1] == '\n':
content = content[0:-1]
if extra != None:
log.write(" %s:%s:%s\n\n" % (type, extra, content))
log.write(" %s:%s:%s\n" % (type, extra, content))
else:
log.write(" %s:%s\n\n" % (type, content))
if error_msg != '':
log.write(" ----\n%s ----\n" % (error_msg))
error_msg = ''
log.write("\n")
return 0
......
......@@ -7625,7 +7625,10 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
(!ctxt->disableSAX))
ctxt->sax->endDocument(ctxt->userData);
if (! ctxt->wellFormed) return(-1);
if (! ctxt->wellFormed) {
ctxt->valid = 0;
return(-1);
}
return(0);
}
......
......@@ -1356,10 +1356,13 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
if (elemDef != NULL) {
if ((type == XML_ATTRIBUTE_ID) &&
(xmlScanIDAttributeDecl(NULL, elemDef) != 0))
(xmlScanIDAttributeDecl(NULL, elemDef) != 0)) {
VERROR(ctxt->userData,
"Element %s has too may ID attributes defined : %s\n",
elem, name);
ctxt->valid = 0;
}
/*
* Insert namespace default def first they need to be
* processed first.
......@@ -4466,6 +4469,7 @@ child_ok:
VERROR(ctxt->userData,
"Element %s namespace name for default namespace does not match the DTD\n",
elem->name);
ret = 0;
}
goto found;
}
......@@ -4481,6 +4485,7 @@ child_ok:
VERROR(ctxt->userData,
"Element %s namespace name for %s doesn't match the DTD\n",
elem->name, ns->prefix);
ret = 0;
}
goto found;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment