mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
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
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
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>
|
Sun Feb 17 20:41:37 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* check-xml-test-suite.py: python script to run regression tests
|
* check-xml-test-suite.py: python script to run regression tests
|
||||||
|
19
SAX.c
19
SAX.c
@ -479,6 +479,7 @@ attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
|
|||||||
elem, fullname, type, def, defaultValue);
|
elem, fullname, type, def, defaultValue);
|
||||||
#endif
|
#endif
|
||||||
name = xmlSplitQName(ctxt, fullname, &prefix);
|
name = xmlSplitQName(ctxt, fullname, &prefix);
|
||||||
|
ctxt->vctxt.valid = 1;
|
||||||
if (ctxt->inSubset == 1)
|
if (ctxt->inSubset == 1)
|
||||||
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
|
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
|
||||||
name, prefix, (xmlAttributeType) type,
|
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);
|
"SAX.attributeDecl(%s) called while not in subset\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* if (attr == 0) ctxt->valid = 0; */
|
if (ctxt->vctxt.valid == 0)
|
||||||
|
ctxt->valid = 0;
|
||||||
if (ctxt->validate && ctxt->wellFormed &&
|
if (ctxt->validate && ctxt->wellFormed &&
|
||||||
ctxt->myDoc && ctxt->myDoc->intSubset)
|
ctxt->myDoc && ctxt->myDoc->intSubset)
|
||||||
ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
|
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,
|
val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
|
||||||
0,0,0);
|
0,0,0);
|
||||||
ctxt->depth--;
|
ctxt->depth--;
|
||||||
|
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||||
ctxt->myDoc, ctxt->node, ret, value);
|
ctxt->myDoc, ctxt->node, ret, value);
|
||||||
else {
|
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->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||||
ctxt->myDoc, ctxt->node, ret, val);
|
ctxt->myDoc, ctxt->node, ret, val);
|
||||||
xmlFree(val);
|
xmlFree(val);
|
||||||
|
@ -17,10 +17,17 @@ log = open(LOG, "w")
|
|||||||
# Error and warning handlers
|
# Error and warning handlers
|
||||||
#
|
#
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
def errorHandler(ctx, str):
|
def errorHandler(ctx, str):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
|
|
||||||
error_nr = error_nr + 1
|
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)
|
libxml2.registerErrorHandler(errorHandler, None)
|
||||||
|
|
||||||
@ -56,9 +63,11 @@ def loadNoentDoc(filename):
|
|||||||
|
|
||||||
def testNotWf(filename, id):
|
def testNotWf(filename, id):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
global log
|
global log
|
||||||
|
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
|
|
||||||
ctxt = libxml2.createFileParserCtxt(filename)
|
ctxt = libxml2.createFileParserCtxt(filename)
|
||||||
if ctxt == None:
|
if ctxt == None:
|
||||||
@ -75,9 +84,11 @@ def testNotWf(filename, id):
|
|||||||
|
|
||||||
def testNotWfEnt(filename, id):
|
def testNotWfEnt(filename, id):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
global log
|
global log
|
||||||
|
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
|
|
||||||
ctxt = libxml2.createFileParserCtxt(filename)
|
ctxt = libxml2.createFileParserCtxt(filename)
|
||||||
if ctxt == None:
|
if ctxt == None:
|
||||||
@ -95,10 +106,11 @@ def testNotWfEnt(filename, id):
|
|||||||
|
|
||||||
def testNotWfEntDtd(filename, id):
|
def testNotWfEntDtd(filename, id):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
global log
|
global log
|
||||||
|
|
||||||
error = ''
|
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
|
|
||||||
ctxt = libxml2.createFileParserCtxt(filename)
|
ctxt = libxml2.createFileParserCtxt(filename)
|
||||||
if ctxt == None:
|
if ctxt == None:
|
||||||
@ -117,10 +129,11 @@ def testNotWfEntDtd(filename, id):
|
|||||||
|
|
||||||
def testWfEntDtd(filename, id):
|
def testWfEntDtd(filename, id):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
global log
|
global log
|
||||||
|
|
||||||
error = ''
|
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
|
|
||||||
ctxt = libxml2.createFileParserCtxt(filename)
|
ctxt = libxml2.createFileParserCtxt(filename)
|
||||||
if ctxt == None:
|
if ctxt == None:
|
||||||
@ -144,9 +157,11 @@ def testWfEntDtd(filename, id):
|
|||||||
|
|
||||||
def testInvalid(filename, id):
|
def testInvalid(filename, id):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
global log
|
global log
|
||||||
|
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
|
|
||||||
ctxt = libxml2.createFileParserCtxt(filename)
|
ctxt = libxml2.createFileParserCtxt(filename)
|
||||||
if ctxt == None:
|
if ctxt == None:
|
||||||
@ -176,8 +191,10 @@ def testInvalid(filename, id):
|
|||||||
|
|
||||||
def testValid(filename, id):
|
def testValid(filename, id):
|
||||||
global error_nr
|
global error_nr
|
||||||
|
global error_msg
|
||||||
|
|
||||||
error_nr = 0
|
error_nr = 0
|
||||||
|
error_msg = ''
|
||||||
|
|
||||||
ctxt = libxml2.createFileParserCtxt(filename)
|
ctxt = libxml2.createFileParserCtxt(filename)
|
||||||
if ctxt == None:
|
if ctxt == None:
|
||||||
@ -213,6 +230,7 @@ def runTest(test):
|
|||||||
global test_failed
|
global test_failed
|
||||||
global test_error
|
global test_error
|
||||||
global test_succeed
|
global test_succeed
|
||||||
|
global error_msg
|
||||||
global log
|
global log
|
||||||
|
|
||||||
uri = test.prop('URI')
|
uri = test.prop('URI')
|
||||||
@ -269,11 +287,17 @@ def runTest(test):
|
|||||||
# Log the ontext
|
# Log the ontext
|
||||||
if res != 1:
|
if res != 1:
|
||||||
log.write(" File: %s\n" % (URI))
|
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:
|
if extra != None:
|
||||||
log.write(" %s:%s:%s\n\n" % (type, extra, content))
|
log.write(" %s:%s:%s\n" % (type, extra, content))
|
||||||
else:
|
else:
|
||||||
log.write(" %s:%s\n\n" % (type, content))
|
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
|
return 0
|
||||||
|
|
||||||
|
5
parser.c
5
parser.c
@ -7625,7 +7625,10 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
|
|||||||
(!ctxt->disableSAX))
|
(!ctxt->disableSAX))
|
||||||
ctxt->sax->endDocument(ctxt->userData);
|
ctxt->sax->endDocument(ctxt->userData);
|
||||||
|
|
||||||
if (! ctxt->wellFormed) return(-1);
|
if (! ctxt->wellFormed) {
|
||||||
|
ctxt->valid = 0;
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
valid.c
7
valid.c
@ -1356,10 +1356,13 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
|
|||||||
if (elemDef != NULL) {
|
if (elemDef != NULL) {
|
||||||
|
|
||||||
if ((type == XML_ATTRIBUTE_ID) &&
|
if ((type == XML_ATTRIBUTE_ID) &&
|
||||||
(xmlScanIDAttributeDecl(NULL, elemDef) != 0))
|
(xmlScanIDAttributeDecl(NULL, elemDef) != 0)) {
|
||||||
VERROR(ctxt->userData,
|
VERROR(ctxt->userData,
|
||||||
"Element %s has too may ID attributes defined : %s\n",
|
"Element %s has too may ID attributes defined : %s\n",
|
||||||
elem, name);
|
elem, name);
|
||||||
|
ctxt->valid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert namespace default def first they need to be
|
* Insert namespace default def first they need to be
|
||||||
* processed first.
|
* processed first.
|
||||||
@ -4466,6 +4469,7 @@ child_ok:
|
|||||||
VERROR(ctxt->userData,
|
VERROR(ctxt->userData,
|
||||||
"Element %s namespace name for default namespace does not match the DTD\n",
|
"Element %s namespace name for default namespace does not match the DTD\n",
|
||||||
elem->name);
|
elem->name);
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
@ -4481,6 +4485,7 @@ child_ok:
|
|||||||
VERROR(ctxt->userData,
|
VERROR(ctxt->userData,
|
||||||
"Element %s namespace name for %s doesn't match the DTD\n",
|
"Element %s namespace name for %s doesn't match the DTD\n",
|
||||||
elem->name, ns->prefix);
|
elem->name, ns->prefix);
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user