mirror of
https://github.com/darlinghq/darling-libxml2.git
synced 2025-02-15 07:49:58 +00:00
OASIS RelaxNG testsuite python script to run regression against OASIS
* test/relaxng/OASIS/spectest.xml: OASIS RelaxNG testsuite * check-relaxng-test-suite.py: python script to run regression against OASIS RelaxNG testsuite * relaxng.c: some cleanup tweaks * HTMLparser.c globals.c: cleanups in comments * doc/libxml2-api.xml: updated the API * result/relaxng/*: errors moved files, so large diffs but no changes at the semantic level. Daniel
This commit is contained in:
parent
6aa2f60373
commit
1703c5fc23
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
Mon Feb 10 15:24:47 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* test/relaxng/OASIS/spectest.xml: OASIS RelaxNG testsuite
|
||||
* check-relaxng-test-suite.py: python script to run regression
|
||||
against OASIS RelaxNG testsuite
|
||||
* relaxng.c: some cleanup tweaks
|
||||
* HTMLparser.c globals.c: cleanups in comments
|
||||
* doc/libxml2-api.xml: updated the API
|
||||
* result/relaxng/*: errors moved files, so large diffs but
|
||||
no changes at the semantic level.
|
||||
|
||||
Mon Feb 10 01:00:31 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tree.c: fixing #105678 problem when dumping a namespace node.
|
||||
|
@ -5529,8 +5529,8 @@ htmlAttrAllowed(const htmlElemDesc* elt, const xmlChar* attr, int legacy) {
|
||||
}
|
||||
/**
|
||||
* htmlNodeStatus:
|
||||
* @node - an htmlNodePtr in a tree
|
||||
* @legacy - whether to allow deprecated elements (YES is faster here
|
||||
* @node: an htmlNodePtr in a tree
|
||||
* @legacy: whether to allow deprecated elements (YES is faster here
|
||||
* for Element nodes)
|
||||
*
|
||||
* Checks whether the tree node is valid. Experimental (the author
|
||||
|
326
check-relaxng-test-suite.py
Executable file
326
check-relaxng-test-suite.py
Executable file
@ -0,0 +1,326 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import string
|
||||
import StringIO
|
||||
sys.path.append("python")
|
||||
import libxml2
|
||||
|
||||
|
||||
#
|
||||
# the testsuite description
|
||||
#
|
||||
CONF="test/relaxng/OASIS/spectest.xml"
|
||||
LOG="check-relaxng-test-suite.log"
|
||||
|
||||
log = open(LOG, "w")
|
||||
nb_schemas_tests = 0
|
||||
nb_schemas_success = 0
|
||||
nb_schemas_failed = 0
|
||||
nb_instances_tests = 0
|
||||
nb_instances_success = 0
|
||||
nb_instances_failed = 0
|
||||
|
||||
libxml2.lineNumbersDefault(1)
|
||||
#
|
||||
# Error and warnng callbacks
|
||||
#
|
||||
def callback(ctx, str):
|
||||
global log
|
||||
log.write("%s%s" % (ctx, str))
|
||||
|
||||
libxml2.registerErrorHandler(callback, "")
|
||||
|
||||
#
|
||||
# Resolver callback
|
||||
#
|
||||
resources = {}
|
||||
def resolver(URL, ID, ctxt):
|
||||
global resources
|
||||
|
||||
if resources.has_key(URL):
|
||||
return(StringIO.StringIO(resources[URL]))
|
||||
log.write("Resolver failure: asked %s\n" % (URL))
|
||||
log.write("resources: %s\n" % (resources))
|
||||
return None
|
||||
|
||||
libxml2.setEntityLoader(resolver)
|
||||
|
||||
#
|
||||
# handle a valid instance
|
||||
#
|
||||
def handle_valid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nFailed to parse correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
return
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
except:
|
||||
ret = -1
|
||||
if ret != 0:
|
||||
log.write("\nFailed to validate correct instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
|
||||
#
|
||||
# handle an invalid instance
|
||||
#
|
||||
def handle_invalid(node, schema):
|
||||
global log
|
||||
global nb_instances_success
|
||||
global nb_instances_failed
|
||||
|
||||
instance = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
instance = instance + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
doc = libxml2.parseDoc(instance)
|
||||
except:
|
||||
doc = None
|
||||
|
||||
if doc == None:
|
||||
log.write("\nStrange: failed to parse incorrect instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
return
|
||||
|
||||
try:
|
||||
ctxt = schema.relaxNGNewValidCtxt()
|
||||
ret = doc.relaxNGValidateDoc(ctxt)
|
||||
except:
|
||||
ret = -1
|
||||
if ret == 0:
|
||||
log.write("\nFailed to detect validation problem in instance:\n-----\n")
|
||||
log.write(instance)
|
||||
log.write("\n-----\n")
|
||||
nb_instances_failed = nb_instances_failed + 1
|
||||
else:
|
||||
nb_instances_success = nb_instances_success + 1
|
||||
|
||||
#
|
||||
# handle an incorrect test
|
||||
#
|
||||
def handle_correct(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs == None:
|
||||
log.write("\nFailed to compile correct schema:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return rngs
|
||||
|
||||
def handle_incorrect(node):
|
||||
global log
|
||||
global nb_schemas_success
|
||||
global nb_schemas_failed
|
||||
|
||||
schema = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
schema = schema + child.serialize()
|
||||
child = child.next
|
||||
|
||||
try:
|
||||
rngp = libxml2.relaxNGNewMemParserCtxt(schema, len(schema))
|
||||
rngs = rngp.relaxNGParse()
|
||||
except:
|
||||
rngs = None
|
||||
if rngs != None:
|
||||
log.write("\nFailed to detect schema error in:\n-----\n")
|
||||
log.write(schema)
|
||||
log.write("\n-----\n")
|
||||
nb_schemas_failed = nb_schemas_failed + 1
|
||||
else:
|
||||
# log.write("\nSuccess detecting schema error in:\n-----\n")
|
||||
# log.write(schema)
|
||||
# log.write("\n-----\n")
|
||||
nb_schemas_success = nb_schemas_success + 1
|
||||
return None
|
||||
|
||||
#
|
||||
# resource handling: keep a dictionary of URL->string mappings
|
||||
#
|
||||
def handle_resource(node, dir):
|
||||
global resources
|
||||
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
res = ""
|
||||
child = node.children
|
||||
while child != None:
|
||||
if child.type != 'text':
|
||||
res = res + child.serialize()
|
||||
child = child.next
|
||||
resources[name] = res
|
||||
|
||||
#
|
||||
# dir handling: pseudo directory resources
|
||||
#
|
||||
def handle_dir(node, dir):
|
||||
try:
|
||||
name = node.prop('name')
|
||||
except:
|
||||
name = None
|
||||
|
||||
if name == None or name == '':
|
||||
log.write("resource has no name")
|
||||
return;
|
||||
|
||||
if dir != None:
|
||||
# name = libxml2.buildURI(name, dir)
|
||||
name = dir + '/' + name
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, name)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, name)
|
||||
|
||||
|
||||
#
|
||||
# handle a testCase element
|
||||
#
|
||||
def handle_testCase(node):
|
||||
global nb_schemas_tests
|
||||
global nb_instances_tests
|
||||
global resources
|
||||
|
||||
log.write("\n ============= test %d line %d ================\n" % (
|
||||
|
||||
nb_schemas_tests, node.lineNo()))
|
||||
resources = {}
|
||||
|
||||
dirs = node.xpathEval('dir')
|
||||
for dir in dirs:
|
||||
handle_dir(dir, None)
|
||||
res = node.xpathEval('resource')
|
||||
for r in res:
|
||||
handle_resource(r, None)
|
||||
|
||||
tsts = node.xpathEval('incorrect')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <incorrect> example" %(node.lineNo())
|
||||
schema = handle_incorrect(tsts[0])
|
||||
else:
|
||||
tsts = node.xpathEval('correct')
|
||||
if tsts != []:
|
||||
if len(tsts) != 1:
|
||||
print "warning test line %d has more than one <correct> example"% (node.lineNo())
|
||||
schema = handle_correct(tsts[0])
|
||||
else:
|
||||
print "warning <testCase> line %d has no <correct> nor <incorrect> child" % (node.lineNo())
|
||||
|
||||
nb_schemas_tests = nb_schemas_tests + 1;
|
||||
|
||||
valids = node.xpathEval('valid')
|
||||
invalids = node.xpathEval('invalid')
|
||||
nb_instances_tests = nb_instances_tests + len(valids) + len(invalids)
|
||||
if schema != None:
|
||||
for valid in valids:
|
||||
handle_valid(valid, schema)
|
||||
for invalid in invalids:
|
||||
handle_invalid(invalid, schema)
|
||||
|
||||
|
||||
#
|
||||
# handle a testSuite element
|
||||
#
|
||||
def handle_testSuite(node):
|
||||
docs = node.xpathEval('documentation')
|
||||
authors = node.xpathEval('author')
|
||||
if docs != []:
|
||||
msg = ""
|
||||
for doc in docs:
|
||||
msg = msg + doc.content + " "
|
||||
if authors != []:
|
||||
msg = msg + "written by "
|
||||
for author in authors:
|
||||
msg = msg + author.content + " "
|
||||
print msg
|
||||
sections = node.xpathEval('section')
|
||||
if sections != []:
|
||||
msg = ""
|
||||
for section in sections:
|
||||
msg = msg + section.content + " "
|
||||
print "Tests for section %s" % (msg)
|
||||
for test in node.xpathEval('testCase'):
|
||||
handle_testCase(test)
|
||||
for test in node.xpathEval('testSuite'):
|
||||
handle_testSuite(test)
|
||||
|
||||
|
||||
#
|
||||
# Parse the conf file
|
||||
#
|
||||
testsuite = libxml2.parseFile(CONF)
|
||||
root = testsuite.getRootElement()
|
||||
if root.name != 'testSuite':
|
||||
print "%s doesn't start with a testSuite element, aborting" % (CONF)
|
||||
sys.exit(1)
|
||||
print "Running Relax NG testsuite"
|
||||
handle_testSuite(root)
|
||||
|
||||
print "\nTOTAL:\nfound %d test schemas: %d success %d failures" % (
|
||||
nb_schemas_tests, nb_schemas_success, nb_schemas_failed)
|
||||
print "found %d test instances: %d success %d failures" % (
|
||||
nb_instances_tests, nb_instances_success, nb_instances_failed)
|
@ -9437,7 +9437,7 @@ actually an xmlCharEncoding'/>
|
||||
</function>
|
||||
<function name='xmlXPathCompile' file='xpath'>
|
||||
<info>Compile an XPath expression</info>
|
||||
<return type='xmlXPathCompExprPtr' info='the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.'/>
|
||||
<return type='xmlXPathCompExprPtr' info='the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.'/>
|
||||
<arg name='str' type='const xmlChar *' info='the XPath expression'/>
|
||||
</function>
|
||||
<function name='xmlXPathCompiledEval' file='xpath'>
|
||||
|
@ -464,7 +464,9 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
|
||||
* xmlRegisterNodeDefault:
|
||||
* @func: function pointer to the new RegisterNodeFunc
|
||||
*
|
||||
* Returns the previous value of the registration function
|
||||
* Registers a callback for node creation
|
||||
*
|
||||
* Returns the old value of the registration function
|
||||
*/
|
||||
xmlRegisterNodeFunc
|
||||
xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
|
||||
@ -479,6 +481,8 @@ xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
|
||||
* xmlDeregisterNodeDefault:
|
||||
* @func: function pointer to the new DeregisterNodeFunc
|
||||
*
|
||||
* Registers a callback for node destruction
|
||||
*
|
||||
* Returns the previous value of the deregistration function
|
||||
*/
|
||||
xmlDeregisterNodeFunc
|
||||
|
78
relaxng.c
78
relaxng.c
@ -1180,9 +1180,16 @@ xmlRelaxNGLoadExternalRef(xmlRelaxNGParserCtxtPtr ctxt, const xmlChar *URL,
|
||||
xmlGenericError(xmlGenericErrorContext, \
|
||||
"error detected at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
#define VALID_ERROR \
|
||||
|
||||
#define VALID_ERROR(a) \
|
||||
if (((ctxt->flags & 1) == 0) || (ctxt->flags & 2)) \
|
||||
printf
|
||||
if (ctxt->error != NULL) ctxt->error(ctxt->userData, a)
|
||||
#define VALID_ERROR2(a, b) \
|
||||
if (((ctxt->flags & 1) == 0) || (ctxt->flags & 2)) \
|
||||
if (ctxt->error != NULL) ctxt->error(ctxt->userData, a, b)
|
||||
#define VALID_ERROR3(a, b, c) \
|
||||
if (((ctxt->flags & 1) == 0) || (ctxt->flags & 2)) \
|
||||
if (ctxt->error != NULL) ctxt->error(ctxt->userData, a, b, c)
|
||||
|
||||
static const char *
|
||||
xmlRelaxNGDefName(xmlRelaxNGDefinePtr def) {
|
||||
@ -1710,14 +1717,16 @@ xmlRelaxNGParseValue(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
||||
} else {
|
||||
def->data = lib;
|
||||
if (lib->have == NULL) {
|
||||
ctxt->error(ctxt->userData,
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData,
|
||||
"Internal error with type library '%s': no 'have'\n",
|
||||
library);
|
||||
ctxt->nbErrors++;
|
||||
} else {
|
||||
tmp = lib->have(lib->data, def->name);
|
||||
if (tmp != 1) {
|
||||
ctxt->error(ctxt->userData,
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData,
|
||||
"Error type '%s' is not exported by type library '%s'\n",
|
||||
def->name, library);
|
||||
ctxt->nbErrors++;
|
||||
@ -1800,14 +1809,16 @@ xmlRelaxNGParseData(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
||||
} else {
|
||||
def->data = lib;
|
||||
if (lib->have == NULL) {
|
||||
ctxt->error(ctxt->userData,
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData,
|
||||
"Internal error with type library '%s': no 'have'\n",
|
||||
library);
|
||||
ctxt->nbErrors++;
|
||||
} else {
|
||||
tmp = lib->have(lib->data, def->name);
|
||||
if (tmp != 1) {
|
||||
ctxt->error(ctxt->userData,
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData,
|
||||
"Error type '%s' is not exported by type library '%s'\n",
|
||||
def->name, library);
|
||||
ctxt->nbErrors++;
|
||||
@ -1817,6 +1828,7 @@ xmlRelaxNGParseData(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
||||
content = node->children;
|
||||
while (content != NULL) {
|
||||
TODO
|
||||
ctxt->nbErrors++;
|
||||
content = content->next;
|
||||
}
|
||||
|
||||
@ -2511,6 +2523,7 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
||||
}
|
||||
} else {
|
||||
TODO
|
||||
ctxt->nbErrors++;
|
||||
def = NULL;
|
||||
}
|
||||
return(def);
|
||||
@ -2598,6 +2611,7 @@ xmlRelaxNGParseAttribute(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
||||
case XML_RELAXNG_START:
|
||||
case XML_RELAXNG_EXCEPT:
|
||||
TODO
|
||||
ctxt->nbErrors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2706,6 +2720,7 @@ xmlRelaxNGParseNameClass(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
|
||||
}
|
||||
} else if (IS_RELAXNG(node, "choice")) {
|
||||
TODO
|
||||
ctxt->nbErrors++;
|
||||
} else {
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData,
|
||||
@ -2805,6 +2820,7 @@ xmlRelaxNGParseElement(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
|
||||
case XML_RELAXNG_START:
|
||||
case XML_RELAXNG_EXCEPT:
|
||||
TODO
|
||||
ctxt->nbErrors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2879,10 +2895,10 @@ xmlRelaxNGParseStart(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes) {
|
||||
while (nodes != NULL) {
|
||||
if (IS_RELAXNG(nodes, "empty")) {
|
||||
TODO
|
||||
xmlElemDump(stdout, nodes->doc, nodes);
|
||||
ctxt->nbErrors++;
|
||||
} else if (IS_RELAXNG(nodes, "notAllowed")) {
|
||||
TODO
|
||||
xmlElemDump(stdout, nodes->doc, nodes);
|
||||
ctxt->nbErrors++;
|
||||
} else {
|
||||
def = xmlRelaxNGParsePatterns(ctxt, nodes, 1);
|
||||
ctxt->grammar->start = def;
|
||||
@ -2987,6 +3003,7 @@ xmlRelaxNGCheckReference(xmlRelaxNGDefinePtr ref,
|
||||
}
|
||||
} else {
|
||||
TODO
|
||||
ctxt->nbErrors++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@ -3366,6 +3383,8 @@ xmlRelaxNGNewParserCtxt(const char *URL) {
|
||||
}
|
||||
memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));
|
||||
ret->URL = xmlStrdup((const xmlChar *)URL);
|
||||
ret->error = xmlGenericError;
|
||||
ret->userData = xmlGenericErrorContext;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -3395,6 +3414,8 @@ xmlRelaxNGNewMemParserCtxt(const char *buffer, int size) {
|
||||
memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));
|
||||
ret->buffer = buffer;
|
||||
ret->size = size;
|
||||
ret->error = xmlGenericError;
|
||||
ret->userData = xmlGenericErrorContext;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -3672,7 +3693,7 @@ xmlRelaxNGCleanupDoc(xmlRelaxNGParserCtxtPtr ctxt, xmlDocPtr doc) {
|
||||
xmlNodePtr child, ins, tmp;
|
||||
|
||||
child = cur->children;
|
||||
ins = child;
|
||||
ins = cur;
|
||||
while (child != NULL) {
|
||||
tmp = child->next;
|
||||
xmlUnlinkNode(child);
|
||||
@ -4194,13 +4215,13 @@ xmlRelaxNGValidateDatatype(xmlRelaxNGValidCtxtPtr ctxt, const xmlChar *value,
|
||||
ret = -1;
|
||||
if (ret < 0) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Internal: failed to validate type %s\n", define->name);
|
||||
VALID_ERROR2("Internal: failed to validate type %s\n", define->name);
|
||||
return(-1);
|
||||
} else if (ret == 1) {
|
||||
ret = 0;
|
||||
} else {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Type %s doesn't allow value %s\n", define->name, value);
|
||||
VALID_ERROR3("Type %s doesn't allow value %s\n", define->name, value);
|
||||
return(-1);
|
||||
ret = -1;
|
||||
}
|
||||
@ -4293,7 +4314,7 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
ret = -1;
|
||||
if (ret < 0) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Internal: failed to compare type %s\n",
|
||||
VALID_ERROR2("Internal: failed to compare type %s\n",
|
||||
define->name);
|
||||
return(-1);
|
||||
} else if (ret == 1) {
|
||||
@ -4383,7 +4404,7 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
if ((ret == 0) && (ctxt->state->value != NULL) &&
|
||||
(ctxt->state->value != ctxt->state->endvalue)) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Extra data in list: %s\n", ctxt->state->value);
|
||||
VALID_ERROR2("Extra data in list: %s\n", ctxt->state->value);
|
||||
ret = -1;
|
||||
}
|
||||
xmlFree(val);
|
||||
@ -5063,7 +5084,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
}
|
||||
if (node->type != XML_ELEMENT_NODE) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Expecting an element got %d type\n", node->type);
|
||||
VALID_ERROR2("Expecting an element got %d type\n", node->type);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
@ -5076,7 +5097,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
if (define->name != NULL) {
|
||||
if (!xmlStrEqual(node->name, define->name)) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Expecting element %s, got %s\n",
|
||||
VALID_ERROR3("Expecting element %s, got %s\n",
|
||||
define->name, node->name);
|
||||
ret = -1;
|
||||
break;
|
||||
@ -5085,13 +5106,13 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
if ((define->ns != NULL) && (define->ns[0] != 0)) {
|
||||
if (node->ns == NULL) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Expecting a namespace for element %s\n",
|
||||
VALID_ERROR2("Expecting a namespace for element %s\n",
|
||||
node->name);
|
||||
ret = -1;
|
||||
break;
|
||||
} else if (!xmlStrEqual(node->ns->href, define->ns)) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Expecting element %s has wrong namespace: expecting %s\n",
|
||||
VALID_ERROR3("Expecting element %s has wrong namespace: expecting %s\n",
|
||||
node->name, define->ns);
|
||||
ret = -1;
|
||||
break;
|
||||
@ -5099,7 +5120,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
} else if (define->name != NULL) {
|
||||
if (node->ns != NULL) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Expecting no namespace for element %s\n",
|
||||
VALID_ERROR2("Expecting no namespace for element %s\n",
|
||||
define->name);
|
||||
ret = -1;
|
||||
break;
|
||||
@ -5141,7 +5162,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
state->seq = xmlRelaxNGSkipIgnored(ctxt, state->seq);
|
||||
if (state->seq != NULL) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Extra content for element %s: %s\n",
|
||||
VALID_ERROR3("Extra content for element %s: %s\n",
|
||||
node->name, state->seq->name);
|
||||
ret = -1;
|
||||
#ifdef DEBUG
|
||||
@ -5154,7 +5175,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
for (i = 0;i < state->nbAttrs;i++) {
|
||||
if (state->attrs[i] != NULL) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("Invalid attribute %s for element %s\n",
|
||||
VALID_ERROR3("Invalid attribute %s for element %s\n",
|
||||
state->attrs[i]->name, node->name);
|
||||
ret = -1;
|
||||
}
|
||||
@ -5293,9 +5314,12 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
ret = xmlRelaxNGValidateDatatype(ctxt, content, define);
|
||||
if (ret == -1) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("internal error validating %s\n", define->name);
|
||||
VALID_ERROR2("internal error validating %s\n", define->name);
|
||||
} else if (ret == 0) {
|
||||
ctxt->state->seq = node->next;
|
||||
if (node != NULL)
|
||||
ctxt->state->seq = node->next;
|
||||
else
|
||||
ctxt->state->seq = NULL;
|
||||
}
|
||||
/*
|
||||
* TODO cover the problems with
|
||||
@ -5304,7 +5328,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
*/
|
||||
if ((node != NULL) && (node->next != NULL)) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("The data does not cover the full element %s\n",
|
||||
VALID_ERROR2("The data does not cover the full element %s\n",
|
||||
node->parent->name);
|
||||
ret = -1;
|
||||
}
|
||||
@ -5323,7 +5347,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
ctxt->state->value = oldvalue;
|
||||
if (ret == -1) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("internal error validating %s\n", define->name);
|
||||
VALID_ERROR2("internal error validating %s\n", define->name);
|
||||
} else if (ret == 0) {
|
||||
ctxt->state->seq = node->next;
|
||||
}
|
||||
@ -5334,7 +5358,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
*/
|
||||
if ((node != NULL) && (node->next != NULL)) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("The value does not cover the full element %s\n",
|
||||
VALID_ERROR2("The value does not cover the full element %s\n",
|
||||
node->parent->name);
|
||||
ret = -1;
|
||||
}
|
||||
@ -5369,7 +5393,7 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
*/
|
||||
if ((node != NULL) && (node->next != NULL)) {
|
||||
VALID_CTXT();
|
||||
VALID_ERROR("The list does not cover the full element %s\n",
|
||||
VALID_ERROR2("The list does not cover the full element %s\n",
|
||||
node->parent->name);
|
||||
ret = -1;
|
||||
}
|
||||
@ -5469,6 +5493,8 @@ xmlRelaxNGNewValidCtxt(xmlRelaxNGPtr schema) {
|
||||
}
|
||||
memset(ret, 0, sizeof(xmlRelaxNGValidCtxt));
|
||||
ret->schema = schema;
|
||||
ret->error = xmlGenericError;
|
||||
ret->userData = xmlGenericErrorContext;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Unimplemented block at relaxng.c:4828
|
||||
Unimplemented block at relaxng.c:4849
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting a namespace for element foo
|
||||
extra data on the document
|
||||
./test/relaxng/tutor10_1_4.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5087
|
||||
error detected at relaxng.c:5437
|
||||
error detected at relaxng.c:5108
|
||||
Expecting a namespace for element foo
|
||||
error detected at relaxng.c:5461
|
||||
extra data on the document
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting element foo has wrong namespace: expecting http://www.example.com
|
||||
extra data on the document
|
||||
./test/relaxng/tutor10_1_5.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5093
|
||||
error detected at relaxng.c:5437
|
||||
error detected at relaxng.c:5114
|
||||
Expecting element foo has wrong namespace: expecting http://www.example.com
|
||||
error detected at relaxng.c:5461
|
||||
extra data on the document
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting element foo has wrong namespace: expecting http://www.example.com
|
||||
extra data on the document
|
||||
./test/relaxng/tutor10_1_6.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5093
|
||||
error detected at relaxng.c:5437
|
||||
error detected at relaxng.c:5114
|
||||
Expecting element foo has wrong namespace: expecting http://www.example.com
|
||||
error detected at relaxng.c:5461
|
||||
extra data on the document
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting no namespace for element foo
|
||||
extra data on the document
|
||||
./test/relaxng/tutor10_2_3.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5101
|
||||
error detected at relaxng.c:5437
|
||||
error detected at relaxng.c:5122
|
||||
Expecting no namespace for element foo
|
||||
error detected at relaxng.c:5461
|
||||
extra data on the document
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting no namespace for element foo
|
||||
extra data on the document
|
||||
./test/relaxng/tutor10_2_4.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5101
|
||||
error detected at relaxng.c:5437
|
||||
error detected at relaxng.c:5122
|
||||
Expecting no namespace for element foo
|
||||
error detected at relaxng.c:5461
|
||||
extra data on the document
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor10_7_3.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor10_8_3.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
@ -1,2 +1 @@
|
||||
Invalid attribute foo for element card
|
||||
./test/relaxng/tutor11_2_2.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5156
|
||||
error detected at relaxng.c:5177
|
||||
Invalid attribute foo for element card
|
||||
|
@ -1,2 +1 @@
|
||||
Invalid attribute b for element card
|
||||
./test/relaxng/tutor11_2_3.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5156
|
||||
error detected at relaxng.c:5177
|
||||
Invalid attribute b for element card
|
||||
|
@ -1 +1 @@
|
||||
Unimplemented block at relaxng.c:4828
|
||||
Unimplemented block at relaxng.c:4849
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting element name, got email
|
||||
Extra content for element card: email
|
||||
./test/relaxng/tutor3_2_1.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5078
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5099
|
||||
Expecting element name, got email
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element card: email
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor3_5_2.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5437
|
||||
error detected at relaxng.c:5461
|
||||
extra data on the document
|
||||
|
@ -1,2 +1 @@
|
||||
extra data on the document
|
||||
./test/relaxng/tutor3_7.rng fails to validate
|
||||
|
@ -1,2 +1 @@
|
||||
The data does not cover the full element bad
|
||||
./test/relaxng/tutor5_3_1.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5306
|
||||
error detected at relaxng.c:5330
|
||||
The data does not cover the full element bad
|
||||
|
@ -1,2 +1 @@
|
||||
Invalid attribute preferredFormat for element card
|
||||
./test/relaxng/tutor6_1_3.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5156
|
||||
error detected at relaxng.c:5177
|
||||
Invalid attribute preferredFormat for element card
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element preferredFormat: text
|
||||
./test/relaxng/tutor6_2_4.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element preferredFormat: text
|
||||
|
@ -1,2 +1 @@
|
||||
Invalid attribute preferredFormat for element card
|
||||
./test/relaxng/tutor6_3_1.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5156
|
||||
error detected at relaxng.c:5177
|
||||
Invalid attribute preferredFormat for element card
|
||||
|
@ -1,4 +1 @@
|
||||
Internal: failed to validate type float
|
||||
internal error validating list
|
||||
Extra content for element vector: text
|
||||
./test/relaxng/tutor7_1_2.xml fails to validate
|
||||
|
@ -1,3 +1,6 @@
|
||||
error detected at relaxng.c:4196
|
||||
error detected at relaxng.c:5360
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:4217
|
||||
Internal: failed to validate type float
|
||||
error detected at relaxng.c:5384
|
||||
internal error validating list
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element vector: text
|
||||
|
@ -1,4 +1 @@
|
||||
Extra data in list: 5.6
|
||||
internal error validating list
|
||||
Extra content for element vector: text
|
||||
./test/relaxng/tutor7_1_3.xml fails to validate
|
||||
|
@ -1,3 +1,6 @@
|
||||
error detected at relaxng.c:4385
|
||||
error detected at relaxng.c:5360
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:4406
|
||||
Extra data in list: 5.6
|
||||
error detected at relaxng.c:5384
|
||||
internal error validating list
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element vector: text
|
||||
|
@ -1,3 +1 @@
|
||||
Internal: no state
|
||||
internal error validating list
|
||||
./test/relaxng/tutor7_2_4.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:4360
|
||||
error detected at relaxng.c:5360
|
||||
error detected at relaxng.c:4381
|
||||
Internal: no state
|
||||
error detected at relaxng.c:5384
|
||||
internal error validating list
|
||||
|
@ -1,4 +1 @@
|
||||
Extra data in list: 5.6
|
||||
internal error validating list
|
||||
Extra content for element path: text
|
||||
./test/relaxng/tutor7_3_4.xml fails to validate
|
||||
|
@ -1,3 +1,6 @@
|
||||
error detected at relaxng.c:4385
|
||||
error detected at relaxng.c:5360
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:4406
|
||||
Extra data in list: 5.6
|
||||
error detected at relaxng.c:5384
|
||||
internal error validating list
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element path: text
|
||||
|
@ -1,4 +1 @@
|
||||
Internal: failed to validate type double
|
||||
internal error validating list
|
||||
Extra content for element path: text
|
||||
./test/relaxng/tutor7_3_5.xml fails to validate
|
||||
|
@ -1,3 +1,6 @@
|
||||
error detected at relaxng.c:4196
|
||||
error detected at relaxng.c:5360
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:4217
|
||||
Internal: failed to validate type double
|
||||
error detected at relaxng.c:5384
|
||||
internal error validating list
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element path: text
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element head: meta
|
||||
./test/relaxng/tutor8_2_4.xml fails to validate
|
||||
|
@ -1,3 +1,4 @@
|
||||
Unimplemented block at relaxng.c:4828
|
||||
Unimplemented block at relaxng.c:4828
|
||||
error detected at relaxng.c:5143
|
||||
Unimplemented block at relaxng.c:4849
|
||||
Unimplemented block at relaxng.c:4849
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element head: meta
|
||||
|
@ -1,3 +1 @@
|
||||
Expecting an element, got empty
|
||||
Extra content for element head: meta
|
||||
./test/relaxng/tutor8_2_5.xml fails to validate
|
||||
|
@ -1,2 +1,4 @@
|
||||
error detected at relaxng.c:5059
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5080
|
||||
Expecting an element, got empty
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element head: meta
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element head: base
|
||||
./test/relaxng/tutor8_2_6.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element head: base
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor9_5_2.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor9_5_3.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor9_6_2.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
@ -1,2 +1 @@
|
||||
Extra content for element addressBook: card
|
||||
./test/relaxng/tutor9_6_3.xml fails to validate
|
||||
|
@ -1 +1,2 @@
|
||||
error detected at relaxng.c:5143
|
||||
error detected at relaxng.c:5164
|
||||
Extra content for element addressBook: card
|
||||
|
6845
test/relaxng/OASIS/spectest.xml
Normal file
6845
test/relaxng/OASIS/spectest.xml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user