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
diff --git a/ChangeLog b/ChangeLog
index 207e431..ac55795 100644
--- a/ChangeLog
+++ b/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.
diff --git a/HTMLparser.c b/HTMLparser.c
index 138bf73..7f7bfdf 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -5529,8 +5529,8 @@
}
/**
* 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
diff --git a/check-relaxng-test-suite.py b/check-relaxng-test-suite.py
new file mode 100755
index 0000000..feb6817
--- /dev/null
+++ b/check-relaxng-test-suite.py
@@ -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)
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index ad21fcd..828beb6 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -9437,7 +9437,7 @@
</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'>
diff --git a/globals.c b/globals.c
index 2a50a08..c4eb3f5 100644
--- a/globals.c
+++ b/globals.c
@@ -464,7 +464,9 @@
* 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 @@
* xmlDeregisterNodeDefault:
* @func: function pointer to the new DeregisterNodeFunc
*
+ * Registers a callback for node destruction
+ *
* Returns the previous value of the deregistration function
*/
xmlDeregisterNodeFunc
diff --git a/relaxng.c b/relaxng.c
index 4ff9a7c..3676ec6 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -1180,9 +1180,16 @@
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 @@
} 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 @@
} 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 @@
content = node->children;
while (content != NULL) {
TODO
+ ctxt->nbErrors++;
content = content->next;
}
@@ -2511,6 +2523,7 @@
}
} else {
TODO
+ ctxt->nbErrors++;
def = NULL;
}
return(def);
@@ -2598,6 +2611,7 @@
case XML_RELAXNG_START:
case XML_RELAXNG_EXCEPT:
TODO
+ ctxt->nbErrors++;
break;
}
}
@@ -2706,6 +2720,7 @@
}
} else if (IS_RELAXNG(node, "choice")) {
TODO
+ ctxt->nbErrors++;
} else {
if (ctxt->error != NULL)
ctxt->error(ctxt->userData,
@@ -2805,6 +2820,7 @@
case XML_RELAXNG_START:
case XML_RELAXNG_EXCEPT:
TODO
+ ctxt->nbErrors++;
break;
}
}
@@ -2879,10 +2895,10 @@
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 @@
}
} else {
TODO
+ ctxt->nbErrors++;
}
}
/*
@@ -3366,6 +3383,8 @@
}
memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));
ret->URL = xmlStrdup((const xmlChar *)URL);
+ ret->error = xmlGenericError;
+ ret->userData = xmlGenericErrorContext;
return (ret);
}
@@ -3395,6 +3414,8 @@
memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));
ret->buffer = buffer;
ret->size = size;
+ ret->error = xmlGenericError;
+ ret->userData = xmlGenericErrorContext;
return (ret);
}
@@ -3672,7 +3693,7 @@
xmlNodePtr child, ins, tmp;
child = cur->children;
- ins = child;
+ ins = cur;
while (child != NULL) {
tmp = child->next;
xmlUnlinkNode(child);
@@ -4194,13 +4215,13 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
} 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 @@
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 @@
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 @@
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 @@
*/
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 @@
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 @@
*/
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 @@
*/
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 @@
}
memset(ret, 0, sizeof(xmlRelaxNGValidCtxt));
ret->schema = schema;
+ ret->error = xmlGenericError;
+ ret->userData = xmlGenericErrorContext;
return (ret);
}
diff --git a/result/relaxng/spec1_err b/result/relaxng/spec1_err
index e40f607..0fe2d10 100644
--- a/result/relaxng/spec1_err
+++ b/result/relaxng/spec1_err
@@ -1 +1 @@
-Unimplemented block at relaxng.c:4828
+Unimplemented block at relaxng.c:4849
diff --git a/result/relaxng/tutor10_1_4 b/result/relaxng/tutor10_1_4
index 04a3e5b..a1c0354 100644
--- a/result/relaxng/tutor10_1_4
+++ b/result/relaxng/tutor10_1_4
@@ -1,3 +1 @@
-Expecting a namespace for element foo
-extra data on the document
./test/relaxng/tutor10_1_4.xml fails to validate
diff --git a/result/relaxng/tutor10_1_4.err b/result/relaxng/tutor10_1_4.err
index 7934554..3d25854 100644
--- a/result/relaxng/tutor10_1_4.err
+++ b/result/relaxng/tutor10_1_4.err
@@ -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
diff --git a/result/relaxng/tutor10_1_5 b/result/relaxng/tutor10_1_5
index dbd7836..b45f877 100644
--- a/result/relaxng/tutor10_1_5
+++ b/result/relaxng/tutor10_1_5
@@ -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
diff --git a/result/relaxng/tutor10_1_5.err b/result/relaxng/tutor10_1_5.err
index e8d4bb1..c4ac909 100644
--- a/result/relaxng/tutor10_1_5.err
+++ b/result/relaxng/tutor10_1_5.err
@@ -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
diff --git a/result/relaxng/tutor10_1_6 b/result/relaxng/tutor10_1_6
index 7907afa..4f4f2ed 100644
--- a/result/relaxng/tutor10_1_6
+++ b/result/relaxng/tutor10_1_6
@@ -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
diff --git a/result/relaxng/tutor10_1_6.err b/result/relaxng/tutor10_1_6.err
index e8d4bb1..c4ac909 100644
--- a/result/relaxng/tutor10_1_6.err
+++ b/result/relaxng/tutor10_1_6.err
@@ -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
diff --git a/result/relaxng/tutor10_2_3 b/result/relaxng/tutor10_2_3
index 43b8317..141582c 100644
--- a/result/relaxng/tutor10_2_3
+++ b/result/relaxng/tutor10_2_3
@@ -1,3 +1 @@
-Expecting no namespace for element foo
-extra data on the document
./test/relaxng/tutor10_2_3.xml fails to validate
diff --git a/result/relaxng/tutor10_2_3.err b/result/relaxng/tutor10_2_3.err
index 35b54a4..fb0f5b8 100644
--- a/result/relaxng/tutor10_2_3.err
+++ b/result/relaxng/tutor10_2_3.err
@@ -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
diff --git a/result/relaxng/tutor10_2_4 b/result/relaxng/tutor10_2_4
index 26d37b7..91af512 100644
--- a/result/relaxng/tutor10_2_4
+++ b/result/relaxng/tutor10_2_4
@@ -1,3 +1 @@
-Expecting no namespace for element foo
-extra data on the document
./test/relaxng/tutor10_2_4.xml fails to validate
diff --git a/result/relaxng/tutor10_2_4.err b/result/relaxng/tutor10_2_4.err
index 35b54a4..fb0f5b8 100644
--- a/result/relaxng/tutor10_2_4.err
+++ b/result/relaxng/tutor10_2_4.err
@@ -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
diff --git a/result/relaxng/tutor10_7_3 b/result/relaxng/tutor10_7_3
index bbebfc8..bd2389c 100644
--- a/result/relaxng/tutor10_7_3
+++ b/result/relaxng/tutor10_7_3
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor10_7_3.xml fails to validate
diff --git a/result/relaxng/tutor10_7_3.err b/result/relaxng/tutor10_7_3.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor10_7_3.err
+++ b/result/relaxng/tutor10_7_3.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/result/relaxng/tutor10_8_3 b/result/relaxng/tutor10_8_3
index 160e18a..32adc71 100644
--- a/result/relaxng/tutor10_8_3
+++ b/result/relaxng/tutor10_8_3
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor10_8_3.xml fails to validate
diff --git a/result/relaxng/tutor10_8_3.err b/result/relaxng/tutor10_8_3.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor10_8_3.err
+++ b/result/relaxng/tutor10_8_3.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/result/relaxng/tutor11_2_2 b/result/relaxng/tutor11_2_2
index 3fe4480..a2662bf 100644
--- a/result/relaxng/tutor11_2_2
+++ b/result/relaxng/tutor11_2_2
@@ -1,2 +1 @@
-Invalid attribute foo for element card
./test/relaxng/tutor11_2_2.xml fails to validate
diff --git a/result/relaxng/tutor11_2_2.err b/result/relaxng/tutor11_2_2.err
index 43abea6..c423d13 100644
--- a/result/relaxng/tutor11_2_2.err
+++ b/result/relaxng/tutor11_2_2.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5156
+error detected at relaxng.c:5177
+Invalid attribute foo for element card
diff --git a/result/relaxng/tutor11_2_3 b/result/relaxng/tutor11_2_3
index d183cfb..419de59 100644
--- a/result/relaxng/tutor11_2_3
+++ b/result/relaxng/tutor11_2_3
@@ -1,2 +1 @@
-Invalid attribute b for element card
./test/relaxng/tutor11_2_3.xml fails to validate
diff --git a/result/relaxng/tutor11_2_3.err b/result/relaxng/tutor11_2_3.err
index 43abea6..2d4fb59 100644
--- a/result/relaxng/tutor11_2_3.err
+++ b/result/relaxng/tutor11_2_3.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5156
+error detected at relaxng.c:5177
+Invalid attribute b for element card
diff --git a/result/relaxng/tutor12_1_err b/result/relaxng/tutor12_1_err
index e40f607..0fe2d10 100644
--- a/result/relaxng/tutor12_1_err
+++ b/result/relaxng/tutor12_1_err
@@ -1 +1 @@
-Unimplemented block at relaxng.c:4828
+Unimplemented block at relaxng.c:4849
diff --git a/result/relaxng/tutor3_2_1 b/result/relaxng/tutor3_2_1
index 336b2de..531fcf7 100644
--- a/result/relaxng/tutor3_2_1
+++ b/result/relaxng/tutor3_2_1
@@ -1,3 +1 @@
-Expecting element name, got email
-Extra content for element card: email
./test/relaxng/tutor3_2_1.xml fails to validate
diff --git a/result/relaxng/tutor3_2_1.err b/result/relaxng/tutor3_2_1.err
index eabd308..a005926 100644
--- a/result/relaxng/tutor3_2_1.err
+++ b/result/relaxng/tutor3_2_1.err
@@ -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
diff --git a/result/relaxng/tutor3_5_2 b/result/relaxng/tutor3_5_2
index b71d10c..4dcea49 100644
--- a/result/relaxng/tutor3_5_2
+++ b/result/relaxng/tutor3_5_2
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor3_5_2.xml fails to validate
diff --git a/result/relaxng/tutor3_5_2.err b/result/relaxng/tutor3_5_2.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor3_5_2.err
+++ b/result/relaxng/tutor3_5_2.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/result/relaxng/tutor3_7_err b/result/relaxng/tutor3_7_err
index 96dd8ee..c2aa66d 100644
--- a/result/relaxng/tutor3_7_err
+++ b/result/relaxng/tutor3_7_err
@@ -1 +1,2 @@
-error detected at relaxng.c:5437
+error detected at relaxng.c:5461
+extra data on the document
diff --git a/result/relaxng/tutor3_7_valid b/result/relaxng/tutor3_7_valid
index 1e17969..f7f3485 100644
--- a/result/relaxng/tutor3_7_valid
+++ b/result/relaxng/tutor3_7_valid
@@ -1,2 +1 @@
-extra data on the document
./test/relaxng/tutor3_7.rng fails to validate
diff --git a/result/relaxng/tutor5_3_1 b/result/relaxng/tutor5_3_1
index dff112b..2c33d6c 100644
--- a/result/relaxng/tutor5_3_1
+++ b/result/relaxng/tutor5_3_1
@@ -1,2 +1 @@
-The data does not cover the full element bad
./test/relaxng/tutor5_3_1.xml fails to validate
diff --git a/result/relaxng/tutor5_3_1.err b/result/relaxng/tutor5_3_1.err
index 62269a0..07da516 100644
--- a/result/relaxng/tutor5_3_1.err
+++ b/result/relaxng/tutor5_3_1.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5306
+error detected at relaxng.c:5330
+The data does not cover the full element bad
diff --git a/result/relaxng/tutor6_1_3 b/result/relaxng/tutor6_1_3
index 1169464..70aa588 100644
--- a/result/relaxng/tutor6_1_3
+++ b/result/relaxng/tutor6_1_3
@@ -1,2 +1 @@
-Invalid attribute preferredFormat for element card
./test/relaxng/tutor6_1_3.xml fails to validate
diff --git a/result/relaxng/tutor6_1_3.err b/result/relaxng/tutor6_1_3.err
index 43abea6..56a9a14 100644
--- a/result/relaxng/tutor6_1_3.err
+++ b/result/relaxng/tutor6_1_3.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5156
+error detected at relaxng.c:5177
+Invalid attribute preferredFormat for element card
diff --git a/result/relaxng/tutor6_2_4 b/result/relaxng/tutor6_2_4
index 24de334..bccc78f 100644
--- a/result/relaxng/tutor6_2_4
+++ b/result/relaxng/tutor6_2_4
@@ -1,2 +1 @@
-Extra content for element preferredFormat: text
./test/relaxng/tutor6_2_4.xml fails to validate
diff --git a/result/relaxng/tutor6_2_4.err b/result/relaxng/tutor6_2_4.err
index 8fcd183..b78fdf9 100644
--- a/result/relaxng/tutor6_2_4.err
+++ b/result/relaxng/tutor6_2_4.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element preferredFormat: text
diff --git a/result/relaxng/tutor6_3_1 b/result/relaxng/tutor6_3_1
index d241c41..84fed8f 100644
--- a/result/relaxng/tutor6_3_1
+++ b/result/relaxng/tutor6_3_1
@@ -1,2 +1 @@
-Invalid attribute preferredFormat for element card
./test/relaxng/tutor6_3_1.xml fails to validate
diff --git a/result/relaxng/tutor6_3_1.err b/result/relaxng/tutor6_3_1.err
index 43abea6..56a9a14 100644
--- a/result/relaxng/tutor6_3_1.err
+++ b/result/relaxng/tutor6_3_1.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5156
+error detected at relaxng.c:5177
+Invalid attribute preferredFormat for element card
diff --git a/result/relaxng/tutor7_1_2 b/result/relaxng/tutor7_1_2
index eb66453..1ee1ccf 100644
--- a/result/relaxng/tutor7_1_2
+++ b/result/relaxng/tutor7_1_2
@@ -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
diff --git a/result/relaxng/tutor7_1_2.err b/result/relaxng/tutor7_1_2.err
index 3a8a7db..2dfdcba 100644
--- a/result/relaxng/tutor7_1_2.err
+++ b/result/relaxng/tutor7_1_2.err
@@ -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
diff --git a/result/relaxng/tutor7_1_3 b/result/relaxng/tutor7_1_3
index 69d624e..a0d8c90 100644
--- a/result/relaxng/tutor7_1_3
+++ b/result/relaxng/tutor7_1_3
@@ -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
diff --git a/result/relaxng/tutor7_1_3.err b/result/relaxng/tutor7_1_3.err
index ac8d77a..727cb37 100644
--- a/result/relaxng/tutor7_1_3.err
+++ b/result/relaxng/tutor7_1_3.err
@@ -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
diff --git a/result/relaxng/tutor7_2_4 b/result/relaxng/tutor7_2_4
index 0480b38..6477251 100644
--- a/result/relaxng/tutor7_2_4
+++ b/result/relaxng/tutor7_2_4
@@ -1,3 +1 @@
-Internal: no state
-internal error validating list
./test/relaxng/tutor7_2_4.xml fails to validate
diff --git a/result/relaxng/tutor7_2_4.err b/result/relaxng/tutor7_2_4.err
index 119e233..3ee9360 100644
--- a/result/relaxng/tutor7_2_4.err
+++ b/result/relaxng/tutor7_2_4.err
@@ -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
diff --git a/result/relaxng/tutor7_3_4 b/result/relaxng/tutor7_3_4
index 9663c6d..8f5ce84 100644
--- a/result/relaxng/tutor7_3_4
+++ b/result/relaxng/tutor7_3_4
@@ -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
diff --git a/result/relaxng/tutor7_3_4.err b/result/relaxng/tutor7_3_4.err
index ac8d77a..cb0fdf6 100644
--- a/result/relaxng/tutor7_3_4.err
+++ b/result/relaxng/tutor7_3_4.err
@@ -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
diff --git a/result/relaxng/tutor7_3_5 b/result/relaxng/tutor7_3_5
index c23d4b1..856ee34 100644
--- a/result/relaxng/tutor7_3_5
+++ b/result/relaxng/tutor7_3_5
@@ -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
diff --git a/result/relaxng/tutor7_3_5.err b/result/relaxng/tutor7_3_5.err
index 3a8a7db..66dbf16 100644
--- a/result/relaxng/tutor7_3_5.err
+++ b/result/relaxng/tutor7_3_5.err
@@ -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
diff --git a/result/relaxng/tutor8_2_4 b/result/relaxng/tutor8_2_4
index 3b53125..d50e6d7 100644
--- a/result/relaxng/tutor8_2_4
+++ b/result/relaxng/tutor8_2_4
@@ -1,2 +1 @@
-Extra content for element head: meta
./test/relaxng/tutor8_2_4.xml fails to validate
diff --git a/result/relaxng/tutor8_2_4.err b/result/relaxng/tutor8_2_4.err
index 4317d77..da513e4 100644
--- a/result/relaxng/tutor8_2_4.err
+++ b/result/relaxng/tutor8_2_4.err
@@ -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
diff --git a/result/relaxng/tutor8_2_5 b/result/relaxng/tutor8_2_5
index 453f756..bd568d7 100644
--- a/result/relaxng/tutor8_2_5
+++ b/result/relaxng/tutor8_2_5
@@ -1,3 +1 @@
-Expecting an element, got empty
-Extra content for element head: meta
./test/relaxng/tutor8_2_5.xml fails to validate
diff --git a/result/relaxng/tutor8_2_5.err b/result/relaxng/tutor8_2_5.err
index 9f6bbaa..53a5f29 100644
--- a/result/relaxng/tutor8_2_5.err
+++ b/result/relaxng/tutor8_2_5.err
@@ -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
diff --git a/result/relaxng/tutor8_2_6 b/result/relaxng/tutor8_2_6
index 9a9c2d6..86645ff 100644
--- a/result/relaxng/tutor8_2_6
+++ b/result/relaxng/tutor8_2_6
@@ -1,2 +1 @@
-Extra content for element head: base
./test/relaxng/tutor8_2_6.xml fails to validate
diff --git a/result/relaxng/tutor8_2_6.err b/result/relaxng/tutor8_2_6.err
index 8fcd183..1f757c6 100644
--- a/result/relaxng/tutor8_2_6.err
+++ b/result/relaxng/tutor8_2_6.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element head: base
diff --git a/result/relaxng/tutor9_5_2 b/result/relaxng/tutor9_5_2
index 13290a4..04097ec 100644
--- a/result/relaxng/tutor9_5_2
+++ b/result/relaxng/tutor9_5_2
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor9_5_2.xml fails to validate
diff --git a/result/relaxng/tutor9_5_2.err b/result/relaxng/tutor9_5_2.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor9_5_2.err
+++ b/result/relaxng/tutor9_5_2.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/result/relaxng/tutor9_5_3 b/result/relaxng/tutor9_5_3
index 3f7f923..eabbcd9 100644
--- a/result/relaxng/tutor9_5_3
+++ b/result/relaxng/tutor9_5_3
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor9_5_3.xml fails to validate
diff --git a/result/relaxng/tutor9_5_3.err b/result/relaxng/tutor9_5_3.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor9_5_3.err
+++ b/result/relaxng/tutor9_5_3.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/result/relaxng/tutor9_6_2 b/result/relaxng/tutor9_6_2
index 164ad69..f1413cd 100644
--- a/result/relaxng/tutor9_6_2
+++ b/result/relaxng/tutor9_6_2
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor9_6_2.xml fails to validate
diff --git a/result/relaxng/tutor9_6_2.err b/result/relaxng/tutor9_6_2.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor9_6_2.err
+++ b/result/relaxng/tutor9_6_2.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/result/relaxng/tutor9_6_3 b/result/relaxng/tutor9_6_3
index 6f9e2d6..1011ecd 100644
--- a/result/relaxng/tutor9_6_3
+++ b/result/relaxng/tutor9_6_3
@@ -1,2 +1 @@
-Extra content for element addressBook: card
./test/relaxng/tutor9_6_3.xml fails to validate
diff --git a/result/relaxng/tutor9_6_3.err b/result/relaxng/tutor9_6_3.err
index 8fcd183..984a201 100644
--- a/result/relaxng/tutor9_6_3.err
+++ b/result/relaxng/tutor9_6_3.err
@@ -1 +1,2 @@
-error detected at relaxng.c:5143
+error detected at relaxng.c:5164
+Extra content for element addressBook: card
diff --git a/test/relaxng/OASIS/spectest.xml b/test/relaxng/OASIS/spectest.xml
new file mode 100644
index 0000000..18afb2e
--- /dev/null
+++ b/test/relaxng/OASIS/spectest.xml
@@ -0,0 +1,6845 @@
+<!DOCTYPE testSuite [
+<!ENTITY dii "<ดี/>">
+]>
+<testSuite>
+<author>James Clark</author>
+<email>jjc@jclark.com</email>
+<documentation>For October 26 version of the spec.</documentation>
+<testSuite>
+<section>3</section>
+<testSuite>
+<documentation>Various possible syntax errors.</documentation>
+<testCase>
+<section>3</section>
+<incorrect>
+<thisIsJunk/>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="foo">
+ <empty/>
+ </element>
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <define name="bar">
+ <text/>
+ </define>
+ <text/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <name>foo</name>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <group>
+ <name>bar</name>
+ </group>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <anyName>
+ <except>
+ <name>foo</name>
+ </except>
+ <except>
+ <name>bar</name>
+ </except>
+ </anyName>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <nsName>
+ <except>
+ <name>foo</name>
+ </except>
+ <except>
+ <name>bar</name>
+ </except>
+ </nsName>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <data type="token">
+ <except>
+ <value>foo</value>
+ </except>
+ <except>
+ <value>bar</value>
+ </except>
+ </data>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty name="bar"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo" extra="bar">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty>
+ <empty/>
+ </empty>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <text>
+ <empty/>
+ </text>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <choice>
+ <text/>
+ <notAllowed>
+ <empty/>
+ </notAllowed>
+ </choice>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo">
+ <empty/>
+ </ref>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <grammar>
+ <start>
+ <parentRef name="foo">
+ <empty/>
+ </parentRef>
+ </start>
+ </grammar>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Tests for obsolete syntax</documentation>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo" ns="http://www.example.com">
+ <attribute name="bar" global="true">
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <not>
+ <name>foo</name>
+ </not>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <difference>
+ <anyName/>
+ <name>foo</name>
+ </difference>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <data type="token" key="foo"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <data type="token" keyRef="foo"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <keyRef name="foo">
+ <data type="token"/>
+ </keyRef>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <key name="foo">
+ <data type="token"/>
+ </key>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Tests for missing attributes and child elements</documentation>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name>foo</name>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <zeroOrMore/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <mixed/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice/>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <anyName>
+ <except/>
+ </anyName>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <nsName ns="">
+ <except/>
+ </nsName>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string">
+ <except/>
+ </data>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string">
+ <param/>
+ </data>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <grammar>
+ <start/>
+ </grammar>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="bar">
+ <empty/>
+ </element>
+ </start>
+ <define name="baz"/>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <externalRef/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include/>
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+ <define>
+ <element name="bar">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref/>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <grammar>
+ <start>
+ <parentRef/>
+ </start>
+ </grammar>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Checking of ns attribute</documentation>
+<testCase>
+<section>3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>No checking of ns attribute is performed</documentation>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="DAV:">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo xmlns="DAV:"/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>No checking of ns attribute is performed</documentation>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="xyzzy">
+ <empty/>
+</element>
+</correct>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>No checking of ns attribute is performed</documentation>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="bad_scheme://">
+ <empty/>
+</element>
+</correct>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Checking of datatypeLibrary attribute</documentation>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foo_bar:xyzzy">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foobar:xyzzy">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http:ok">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foo:">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.example.com/%">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.example.com/%xx">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must conform to RFC 2396</documentation>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.example.com/%Aa">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy#foo:bar">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy?foo:bar">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must not be relative</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="xyzzy/foo:bar">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="foo:bar">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data datatypeLibrary="" type="string"/>
+</element>
+</correct>
+<valid>
+<foo>x</foo>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must not contain fragment identifier</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.example.com#xyzzy">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<documentation>Value of datatypeLibrary attribute must not contain fragment identifier</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.example.com#">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Tests for QName and NCNames in schemas</documentation>
+<testCase>
+<section>3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="ดี">
+ <empty/>
+ </element>
+</element>
+</correct>
+<valid>
+<foo>&dii;</foo>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="ี" xmlns="http://relaxng.org/ns/structure/1.0">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="" xmlns="http://relaxng.org/ns/structure/1.0">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name>ี</name>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="ี"/>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="ี"/>
+ </start>
+ <define name="ี">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="ดี"/>
+ </start>
+ <define name="ดี">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name=""/>
+ </start>
+ <define name="">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="x y"/>
+ </start>
+ <define name="x y">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:x="http://www.example.com/x">
+ <start>
+ <ref name="x:y"/>
+ </start>
+ <define name="x:y">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:x="http://www.example.com/x"
+ name="x:ี">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:x="http://www.example.com/x"
+ name="x:y:z">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:x="http://www.example.com/x"
+ name="x:">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Tests for elements that allow only a single pattern child.</documentation>
+<testCase>
+<section>3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ <empty/>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <attribute name="bar">
+ <text/>
+ <empty/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <attribute>
+ <name>bar</name>
+ <text/>
+ <empty/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<documentation>Tests for foreign element and attribute handling.</documentation>
+<testCase>
+<section>3</section>
+<incorrect>
+<r:element name="foo" xmlns:r="http://relaxng.org/ns/structure/1.0" r:a="val">
+ <r:empty/>
+</r:element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name>foo<eg:comment xmlns:eg="http://www.example.com"/></name>
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <value>foo<eg:comment xmlns:eg="http://www.example.com"/></value>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <data type="string"><eg:comment xmlns:eg="http://www.example.com"/></data>
+</element>
+</correct>
+<valid>
+<foo>X</foo>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty>
+ <ext xmlns="http://www.example.com">
+ <element xmlns="http://relaxng.org/ns/structure/1.0"/>
+ </ext>
+ </empty>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:eg="http://www.example.com">
+ <eg:comment/>
+ <eg:comment/>
+ <start>
+ <eg:comment/>
+ <element>
+ <eg:comment/>
+ <eg:comment/>
+ <name>foo</name>
+ <eg:comment/>
+ <data type="string"/>
+ <eg:comment/>
+ <empty>
+ <eg:comment/>
+ <eg:comment/>
+ </empty>
+ <eg:comment/>
+ <eg:comment/>
+ </element>
+ <eg:comment/>
+ </start>
+ <eg:comment/>
+</grammar>
+</correct>
+<valid>
+<foo>X</foo>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:eg="http://www.example.com"
+ eg:comment="">
+ <start eg:comment="">
+ <element eg:comment="">
+ <name eg:comment="">foo</name>
+ <data eg:comment="" type="string"/>
+ <empty eg:comment=""/>
+ </element>
+ </start>
+</grammar>
+</correct>
+<valid>
+<foo>X</foo>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0" xmlns="http://www.example.com">
+ <comment/>
+ <comment/>
+ <rng:start>
+ <comment/>
+ <rng:element>
+ <comment/>
+ <comment/>
+ <rng:name>foo</rng:name>
+ <comment/>
+ <rng:data type="string"/>
+ <comment/>
+ </rng:element>
+ <comment/>
+ </rng:start>
+ <comment/>
+</rng:grammar>
+</correct>
+<valid>
+<foo>X</foo>
+</valid>
+</testCase>
+<testCase>
+<section>3</section>
+<correct>
+<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0">
+ <comment/>
+ <comment/>
+ <rng:start>
+ <comment/>
+ <rng:element>
+ <comment/>
+ <comment/>
+ <rng:name>foo</rng:name>
+ <comment/>
+ <rng:data type="string"/>
+ <comment/>
+ </rng:element>
+ <comment/>
+ </rng:start>
+ <comment/>
+</rng:grammar>
+</correct>
+<valid>
+<foo>X</foo>
+</valid>
+</testCase>
+</testSuite>
+</testSuite>
+<testSuite>
+<section>4</section>
+<testSuite>
+<section>4.2</section>
+<testCase>
+<section>4.2</section>
+<correct>
+<element name="

 	foo

 	" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="

 	bar

 	"/>
+</element>
+</correct>
+<valid>
+<foo bar=""/>
+</valid>
+</testCase>
+<testCase>
+<section>4.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="

 	string

 	">bar</value>
+</element>
+</correct>
+<valid>
+<foo>bar</foo>
+</valid>
+<invalid>
+<foo>bar </foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="

 	string

 	"/>
+</element>
+</correct>
+<valid>
+<foo>X</foo>
+</valid>
+</testCase>
+<testCase>
+<section>4.2</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name>

 	foo

 	</name>
+ <attribute><name>

 	bar

 	</name></attribute>
+</element>
+</correct>
+<valid>
+<foo bar=""/>
+</valid>
+</testCase>
+<testCase>
+<section>4.2</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start combine="

 	choice

 	">
+ <ref name="

 	x

 	"/>
+ </start>
+ <define name="x">
+ <ref name="y"/>
+ </define>
+ <define name="

 	y

 	">
+ <grammar>
+ <start combine="

 	interleave

 	">
+ <parentRef name="

 	z

 	"/>
+ </start>
+ </grammar>
+ </define>
+ <define name="z">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+</testSuite>
+<testCase>
+<section>4.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value datatypeLibrary="http://www.example.com/this-does-not-exist">bar</value>
+</element>
+</correct>
+<valid>
+<foo>bar</foo>
+</valid>
+<valid>
+<foo>
+ bar
+</foo>
+</valid>
+<valid>
+<foo> bar </foo>
+</valid>
+<invalid>
+<foo>baz</foo>
+</invalid>
+<invalid>
+<foo>ba r</foo>
+</invalid>
+</testCase>
+<testSuite>
+<section>4.5</section>
+<testCase>
+<section>4.5</section>
+<dir name="sub">
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty/>
+</element>
+</resource>
+</dir>
+<correct>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0"
+ xml:base="sub/y" href="x"/>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.5</section>
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="bar">
+ <empty/>
+</element>
+</resource>
+<dir name="sub1">
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="bar">
+ <empty/>
+</element>
+</resource>
+<dir name="sub3">
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty/>
+</element>
+</resource>
+</dir>
+</dir>
+<correct>
+<group xmlns="http://relaxng.org/ns/structure/1.0" xml:base="sub1/">
+ <group>
+ <group xml:base="sub2">
+ <group>
+ <group xml:base="sub3/y">
+ <externalRef href="x"/>
+ </group>
+ </group>
+ </group>
+ </group>
+</group>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.5</section>
+<resource name="x">
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <empty/>
+</element>
+</resource>
+<incorrect>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x#foo"/>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.6</section>
+<testCase>
+<section>4.6</section>
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty/>
+</element>
+</resource>
+<correct>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.6</section>
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty/>
+</element>
+</resource>
+<correct>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x" ns="http://www.example.com"/>
+</correct>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.6</section>
+<resource name="x">
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
+</resource>
+<incorrect>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.6</section>
+<resource name="x">
+<start xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="foo">
+ <empty/>
+ </element>
+</start>
+</resource>
+<incorrect>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.6</section>
+<resource name="x">
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="y"/>
+</resource>
+<resource name="y">
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
+</resource>
+<incorrect>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="x"/>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.6</section>
+<documentation>Same value of href before resolution, but not a loop.</documentation>
+<dir name="sub">
+<resource name="x">
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="sub/x"/>
+</resource>
+<dir name="sub">
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty/>
+</element>
+</resource>
+</dir>
+</dir>
+<correct>
+<externalRef xmlns="http://relaxng.org/ns/structure/1.0" href="sub/x"/>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.7</section>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</resource>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</resource>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x" ns="http://www.example.com"/>
+</grammar>
+</correct>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="y"/>
+</grammar>
+</resource>
+<resource name="y">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</resource>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <empty/>
+</element>
+</resource>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</resource>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="y"/>
+</grammar>
+</resource>
+<resource name="y">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</resource>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.7</section>
+<dir name="sub">
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="sub/x"/>
+</grammar>
+</resource>
+<dir name="sub">
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+</grammar>
+</resource>
+</dir>
+</dir>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="sub/x"/>
+</grammar>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</resource>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x">
+ <start>
+ <ref name="foo"/>
+ </start>
+ </include>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</resource>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+ <start>
+ <ref name="foo"/>
+ </start>
+</grammar>
+</correct>
+<valid><foo/></valid>
+<invalid><bar/></invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+</grammar>
+</resource>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </include>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+</grammar>
+</resource>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <include href="x"/>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid><foo/></valid>
+<invalid><bar/></invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="x">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="foo" combine="choice">
+ <element name="foo3">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</resource>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+ <include href="x">
+ <define name="foo" combine="choice">
+ <element name="foo1">
+ <empty/>
+ </element>
+ </define>
+ </include>
+ <define name="foo">
+ <element name="foo2">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid><foo1/></valid>
+<valid><foo2/></valid>
+<invalid><foo3/></invalid>
+</testCase>
+<testCase>
+<section>4.7</section>
+<resource name="level1.rng">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<include href="level2.rng">
+ <define name="foo">
+ <element name="bar">
+ <empty/>
+ </element>
+ </define>
+</include>
+</grammar>
+</resource>
+<resource name="level2.rng">
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="bar">
+ <element name="bar">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</resource>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <ref name="foo"/>
+</start>
+<include href="level1.rng">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</include>
+</grammar>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.8</section>
+<testCase>
+<section>4.8</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.example.com" name="foo">
+ <attribute name="bar" ns="http://www.example.com"/>
+</element>
+</correct>
+<valid>
+<eg:foo eg:bar="x" xmlns:eg="http://www.example.com"/>
+</valid>
+<invalid>
+<eg:foo xmlns:eg="http://www.example.com" bar="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.8</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.example.com" name="foo">
+ <attribute name="bar"/>
+</element>
+</correct>
+<invalid>
+<eg:foo xmlns:eg="http://www.example.com" eg:bar="x"/>
+</invalid>
+<valid>
+<eg:foo xmlns:eg="http://www.example.com" bar="x"/>
+</valid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.9</section>
+<testCase>
+<section>4.9</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.example.com" name="foo">
+ <attribute>
+ <name>bar</name>
+ </attribute>
+</element>
+</correct>
+<valid>
+<eg:foo xmlns:eg="http://www.example.com" eg:bar="x"/>
+</valid>
+<invalid>
+<eg:foo xmlns:eg="http://www.example.com" bar="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.6</section>
+<section>4.9</section>
+<resource name="x">
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <empty/>
+</element>
+</resource>
+<correct>
+<group ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0" >
+<externalRef href="x"/>
+</group>
+</correct>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<correct>
+<group xmlns="http://relaxng.org/ns/structure/1.0">
+ <element ns="http://www.example.com">
+ <name>foo</name>
+ <empty/>
+ </element>
+</group>
+</correct>
+<valid><foo xmlns="http://www.example.com"/></valid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<correct>
+<element ns="http://www.example.com" xmlns="http://relaxng.org/ns/structure/1.0">
+ <name>foo</name>
+ <empty/>
+</element>
+</correct>
+<valid><foo xmlns="http://www.example.com"/></valid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute ns="http://www.example.com">
+ <name>bar</name>
+ <text/>
+ </attribute>
+</element>
+</correct>
+<valid><foo xmlns:x="http://www.example.com" x:bar="whatever"/></valid>
+<invalid><foo bar="whatever"/></invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.10</section>
+<testCase>
+<section>4.10</section>
+<incorrect>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo:bar">
+ <empty/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.10</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="eg:foo" xmlns:eg="http://www.example.com">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<invalid>
+<foo xmlns="http://www.example.com/"/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.10</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo" xmlns:eg="http://www.example.com">
+ <attribute name="eg:bar"/>
+</element>
+</correct>
+<valid>
+<foo xmlns:ex="http://www.example.com" ex:bar="x"/>
+</valid>
+<invalid>
+<foo xmlns:ex="http://www.example.com/" ex:bar="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.10</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <attribute name="xml:lang"/>
+</element>
+</correct>
+<valid>
+<foo xml:lang="en"/>
+</valid>
+<invalid>
+<foo lang="en"/>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.11</section>
+<testCase>
+<section>4.11</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <div ns="http://www.example.com">
+ <div>
+ <start>
+ <ref name="foo"/>
+ </start>
+ </div>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </div>
+ <div/>
+</grammar>
+</correct>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<testCase>
+<section>4.12</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+
+<start>
+ <element name="foo">
+ <ref name="bars"/>
+ </element>
+</start>
+
+<define name="bars">
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+</define>
+
+</grammar>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo></foo>
+</invalid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/>X<bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<valid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo></foo>
+</invalid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/>X<bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<section>4.15</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <zeroOrMore>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </zeroOrMore>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<valid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<valid>
+<foo></foo>
+</valid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/>X<bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<section>4.14</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </optional>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<valid>
+<foo></foo>
+</valid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/>X<bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <value>x</value>
+ <value>y</value>
+ <value>z</value>
+ </list>
+</element>
+</correct>
+<valid>
+<foo>x y z</foo>
+</valid>
+<invalid>
+<foo>x</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<section>4.13</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <mixed>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </mixed>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo></foo>
+</invalid>
+<valid>
+<foo><bar/>X<bar/><bar/></foo>
+</valid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name>foo</name>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo></foo>
+</invalid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/>X<bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <anyName>
+ <except>
+ <name>foo</name>
+ <name>bar</name>
+ <name>baz</name>
+ </except>
+ </anyName>
+ <empty/>
+</element>
+</correct>
+<valid><xyzzy/></valid>
+<invalid><foo/></invalid>
+<invalid><bar/></invalid>
+<invalid><baz/></invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="token">
+ <except>
+ <value>x</value>
+ <value>y</value>
+ <value>z</value>
+ </except>
+ </data>
+</element>
+</correct>
+<valid><foo/></valid>
+<valid><foo>xyz</foo></valid>
+<invalid><foo>x</foo></invalid>
+<invalid><foo>y</foo></invalid>
+<invalid><foo>y</foo></invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+</element>
+</correct>
+<valid>
+<foo bar=""/>
+</valid>
+<valid>
+<foo bar="x"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name>bar</name>
+ </attribute>
+</element>
+</correct>
+<valid>
+<foo bar=""/>
+</valid>
+<valid>
+<foo bar="x"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </group>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo></foo>
+</invalid>
+<invalid>
+<foo>X</foo>
+</invalid>
+<invalid>
+<foo><bar/>X<bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <element name="bar1">
+ <empty/>
+ </element>
+ <element name="bar2">
+ <empty/>
+ </element>
+ <element name="bar3">
+ <empty/>
+ </element>
+ </choice>
+</element>
+</correct>
+<valid><foo><bar1/></foo></valid>
+<valid><foo><bar2/></foo></valid>
+<valid><foo><bar3/></foo></valid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar1">
+ <empty/>
+ </element>
+ <element name="bar2">
+ <empty/>
+ </element>
+ <element name="bar3">
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</correct>
+<valid><foo><bar1/><bar2/><bar3/></foo></valid>
+<valid><foo><bar1/><bar3/><bar2/></foo></valid>
+<valid><foo><bar2/><bar1/><bar3/></foo></valid>
+<valid><foo><bar2/><bar3/><bar1/></foo></valid>
+<valid><foo><bar3/><bar1/><bar2/></foo></valid>
+<valid><foo><bar3/><bar2/><bar1/></foo></valid>
+<invalid><foo><bar2/><bar1/></foo></invalid>
+<invalid><foo><bar1/><bar3/><bar2/><bar1/></foo></invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <element name="bar">
+ <empty/>
+ </element>
+ </group>
+</element>
+</correct>
+<valid><foo><bar/></foo></valid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</correct>
+<valid><foo><bar/></foo></valid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<section>4.12</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <element name="bar">
+ <empty/>
+ </element>
+ </choice>
+</element>
+</correct>
+<valid><foo><bar/></foo></valid>
+<invalid><foo/></invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.13</section>
+<testCase>
+<section>4.13</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <mixed>
+ <element name="bar">
+ <empty/>
+ </element>
+ </mixed>
+</element>
+</correct>
+<valid><foo>x<bar/></foo></valid>
+<valid><foo><bar/></foo></valid>
+<valid><foo><bar/>x</foo></valid>
+<valid><foo>x<bar/>y</foo></valid>
+<invalid><foo/></invalid>
+<invalid><foo><bar/><bar/></foo></invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.14</section>
+<testCase>
+<section>4.14</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <element name="bar">
+ <empty/>
+ </element>
+ </optional>
+</element>
+</correct>
+<valid><foo><bar/></foo></valid>
+<valid><foo/></valid>
+<invalid><foo>x<bar/></foo></invalid>
+<invalid><foo><bar/><bar/></foo></invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.15</section>
+<testCase>
+<section>4.15</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <zeroOrMore>
+ <element name="bar">
+ <empty/>
+ </element>
+ </zeroOrMore>
+</element>
+</correct>
+<valid><foo><bar/></foo></valid>
+<valid><foo/></valid>
+<invalid><foo>x<bar/></foo></invalid>
+<invalid><foo><baz/></foo></invalid>
+<valid><foo><bar/><bar/></foo></valid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.16</section>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element>
+ <anyName>
+ <except>
+ <anyName/>
+ </except>
+ </anyName>
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element>
+ <anyName>
+ <except>
+ <choice>
+ <anyName/>
+ <name>foo</name>
+ </choice>
+ </except>
+ </anyName>
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element>
+ <nsName ns="">
+ <except>
+ <nsName ns=""/>
+ </except>
+ </nsName>
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element>
+ <nsName ns="">
+ <except>
+ <choice>
+ <nsName ns=""/>
+ <name>foo</name>
+ </choice>
+ </except>
+ </nsName>
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element>
+ <nsName ns="">
+ <except>
+ <anyName/>
+ </except>
+ </nsName>
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element>
+ <nsName ns="">
+ <except>
+ <choice>
+ <anyName/>
+ <name>foo</name>
+ </choice>
+ </except>
+ </nsName>
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<documentation>Tests that 4.16 is before 4.20.</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <zeroOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <anyName/>
+ </except>
+ </anyName>
+ <text/>
+ </attribute>
+ <notAllowed/>
+ </zeroOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<documentation>Tests that 4.16 is before removal of unreachable definitions.</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <empty/>
+ </element>
+</start>
+<define name="bar">
+ <element>
+ <anyName>
+ <except>
+ <anyName/>
+ </except>
+ </anyName>
+ <empty/>
+ </element>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="xmlns">
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<correct>
+<element name="xmlns" xmlns="http://relaxng.org/ns/structure/1.0">
+ <empty/>
+</element>
+</correct>
+<valid><xmlns/></valid>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name=" xmlns">
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <notAllowed/>
+ <attribute name="xmlns">
+ <text/>
+ </attribute>
+ </optional>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+ <define name="foo">
+ <attribute name="xmlns">
+ <text/>
+ </attribute>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="xmlns" ns="">
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <choice>
+ <name ns="">xmlns</name>
+ <name>foo</name>
+ </choice>
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name ns="">xmlns</name>
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name>xmlns</name>
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name>
+ xmlns
+ </name>
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <choice>
+ <name>foo</name>
+ <name ns="">xmlns</name>
+ </choice>
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <name>xmlns</name>
+ </except>
+ </anyName>
+ <text/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <nsName ns="">
+ <except>
+ <name>xmlns</name>
+ </except>
+ </nsName>
+ <text/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute ns="http://www.w3.org/2000/xmlns" name="bar">
+ <text/>
+ </attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0" ns="http://www.w3.org/2000/xmlns">
+ <empty/>
+</element>
+</correct>
+<valid><foo xmlns="http://www.w3.org/2000/xmlns"/></valid>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="token">
+ <param name="minLength">2</param>
+ </data>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="tok"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="tok"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <notAllowed/>
+ <data type="token">
+ <param name="minLength">2</param>
+ </data>
+ </optional>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <notAllowed/>
+ <data type="tok"/>
+ </optional>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <notAllowed/>
+ <value type="tok"/>
+ </optional>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <empty/>
+ </element>
+</start>
+<define name="foo">
+ <data type="token">
+ <param name="minLength">2</param>
+ </data>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <empty/>
+ </element>
+</start>
+<define name="foo">
+ <data type="tok"/>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.16</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <empty/>
+ </element>
+</start>
+<define name="foo">
+ <value type="tok"/>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.17</section>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <ref name="x"/>
+</start>
+<define name="x">
+ <element name="foo1">
+ <empty/>
+ </element>
+</define>
+<define name="x" combine="choice">
+ <element name="foo2">
+ <empty/>
+ </element>
+</define>
+<define name="x">
+ <element name="foo3">
+ <empty/>
+ </element>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start name="x">
+ <element name="foo1">
+ <empty/>
+ </element>
+</start>
+<start name="x" combine="choice">
+ <element name="foo2">
+ <empty/>
+ </element>
+</start>
+<start name="x">
+ <element name="foo3">
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <ref name="x"/>
+</start>
+<define name="x">
+ <element name="foo1">
+ <empty/>
+ </element>
+</define>
+<define name="x">
+ <element name="foo2">
+ <empty/>
+ </element>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start name="x">
+ <element name="foo1">
+ <empty/>
+ </element>
+</start>
+<start name="x">
+ <element name="foo2">
+ <empty/>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <ref name="x"/>
+</start>
+<define name="x" combine="choice">
+ <element name="foo1">
+ <empty/>
+ </element>
+</define>
+<define name="x" combine="choice">
+ <element name="foo2">
+ <empty/>
+ </element>
+</define>
+<define name="x">
+ <element name="foo3">
+ <empty/>
+ </element>
+</define>
+</grammar>
+</correct>
+<valid>
+<foo1/>
+</valid>
+<valid>
+<foo2/>
+</valid>
+<valid>
+<foo3/>
+</valid>
+<invalid>
+<foo4/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.17</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start combine="choice">
+ <element name="foo1">
+ <empty/>
+ </element>
+</start>
+<start combine="choice">
+ <element name="foo2">
+ <empty/>
+ </element>
+</start>
+<start>
+ <element name="foo3">
+ <empty/>
+ </element>
+</start>
+</grammar>
+</correct>
+<valid>
+<foo1/>
+</valid>
+<valid>
+<foo2/>
+</valid>
+<valid>
+<foo3/>
+</valid>
+<invalid>
+<foo4/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <ref name="x"/>
+ </element>
+</start>
+<define name="x" combine="choice">
+ <element name="bar1">
+ <empty/>
+ </element>
+</define>
+<define name="x">
+ <element name="bar2">
+ <empty/>
+ </element>
+</define>
+<define name="x" combine="interleave">
+ <element name="bar3">
+ <empty/>
+ </element>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+<grammar>
+<start name="x" combine="choice">
+ <element name="bar1">
+ <empty/>
+ </element>
+</start>
+<start name="x">
+ <element name="bar2">
+ <empty/>
+ </element>
+</start>
+<start name="x" combine="interleave">
+ <element name="bar3">
+ <empty/>
+ </element>
+</start>
+</grammar>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <ref name="x"/>
+ </element>
+</start>
+<define name="x" combine="interleave">
+ <element name="bar1">
+ <empty/>
+ </element>
+</define>
+<define name="x" combine="interleave">
+ <element name="bar2">
+ <empty/>
+ </element>
+</define>
+<define name="x">
+ <element name="bar3">
+ <empty/>
+ </element>
+</define>
+</grammar>
+</correct>
+<valid>
+<foo><bar1/><bar2/><bar3/></foo>
+</valid>
+<valid>
+<foo><bar1/><bar3/><bar2/></foo>
+</valid>
+<valid>
+<foo><bar2/><bar3/><bar1/></foo>
+</valid>
+<invalid>
+<foo><bar2/><bar3/><bar1/><bar2/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.17</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+<grammar>
+<start combine="interleave">
+ <element name="bar1">
+ <empty/>
+ </element>
+</start>
+<start>
+ <element name="bar2">
+ <empty/>
+ </element>
+</start>
+<start combine="interleave">
+ <element name="bar3">
+ <empty/>
+ </element>
+</start>
+</grammar>
+</element>
+</correct>
+<valid>
+<foo><bar1/><bar2/><bar3/></foo>
+</valid>
+<valid>
+<foo><bar1/><bar3/><bar2/></foo>
+</valid>
+<valid>
+<foo><bar2/><bar3/><bar1/></foo>
+</valid>
+<invalid>
+<foo><bar2/><bar3/><bar1/><bar2/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <ref name="x"/>
+ </element>
+</start>
+<define name="x">
+ <element name="bar1">
+ <empty/>
+ </element>
+</define>
+<define name="x" combine="interleave">
+ <element name="bar2">
+ <empty/>
+ </element>
+</define>
+<define name="x">
+ <element name="bar3">
+ <empty/>
+ </element>
+</define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.17</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+<grammar>
+<start name="x">
+ <element name="bar1">
+ <empty/>
+ </element>
+</start>
+<start name="x" combine="interleave">
+ <element name="bar2">
+ <empty/>
+ </element>
+</start>
+<start name="x">
+ <element name="bar3">
+ <empty/>
+ </element>
+</start>
+</grammar>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.18</section>
+<testCase>
+<section>4.18</section>
+<documentation>grammar must have a start</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>4.17 is before 4.18</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+ <define name="bar">
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>4.17 is before 4.19</documentation>
+<incorrect>
+<choice xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="foo">
+ <empty/>
+ </element>
+ <group>
+ <notAllowed/>
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </group>
+</choice>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>every ref must have a def</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>4.17 is before 4.18</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+ <define name="foo">
+ <ref name="bar"/>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>4.17 is before 4.19</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <group>
+ <notAllowed/>
+ <ref name="foo"/>
+ </group>
+ </choice>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>every parentRef must have a def</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <parentRef name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>4.17 is before 4.18</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+ <define name="bar">
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <parentRef name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<documentation>4.17 is before 4.19</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <group>
+ <notAllowed/>
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <parentRef name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </group>
+ </choice>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+ <define name="foo">
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <parentRef name="foo"/>
+ </start>
+ </grammar>
+ </choice>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.18</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+ <define name="foo">
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="foo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </define>
+</grammar>
+</correct>
+<valid><foo/></valid>
+</testCase>
+<testCase>
+<section>4.18</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <grammar>
+ <start>
+ <ref name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="innerFoo">
+ <parentRef name="foo"/>
+ </element>
+ </define>
+ </grammar>
+ </start>
+ <define name="foo">
+ <element name="outerFoo">
+ <empty/>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid><innerFoo><outerFoo/></innerFoo></valid>
+<invalid><outerFoo/></invalid>
+</testCase>
+<testCase>
+<section>4.18</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <ref name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="outerFoo">
+ <grammar>
+ <start>
+ <ref name="foo"/>
+ </start>
+ <define name="foo">
+ <element name="innerFoo">
+ <empty/>
+ </element>
+ </define>
+ </grammar>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid><outerFoo><innerFoo/></outerFoo></valid>
+<invalid><innerFoo/></invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>4.19</section>
+<testCase>
+<section>4.19</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <ref name="bar"/>
+ </element>
+ </start>
+ <define name="bar">
+ <optional>
+ <element name="bar">
+ <empty/>
+ </element>
+ <ref name="bar"/>
+ </optional>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>4.19</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <ref name="bar"/>
+ </element>
+ </start>
+ <define name="bar">
+ <element name="bar">
+ <optional>
+ <ref name="bar"/>
+ </optional>
+ </element>
+ </define>
+</grammar>
+</correct>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo><bar><bar/></bar></foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>4.19</section>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <empty/>
+ </element>
+ </start>
+ <define name="bar">
+ <ref name="bar"/>
+ </define>
+</grammar>
+</correct>
+<valid><foo/></valid>
+</testCase>
+<testCase>
+<section>4.19</section>
+<section>4.20</section>
+<documentation>Tests that recursion detection happens before
+normalization of notAllowed.</documentation>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <group>
+ <notAllowed/>
+ <ref name="bar"/>
+ </group>
+ </choice>
+ </start>
+ <define name="bar">
+ <element name="bar">
+ <empty/>
+ </element>
+ <optional>
+ <ref name="bar"/>
+ </optional>
+ </define>
+</grammar>
+</incorrect>
+</testCase>
+</testSuite>
+</testSuite>
+<testSuite>
+<section>6</section>
+<testSuite>
+<section>6.1</section>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <anyName/>
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <anyName>
+ <except>
+ <name ns="">foo</name>
+ </except>
+ </anyName>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<foo/>
+</invalid>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<valid>
+<bar/>
+</valid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <anyName>
+ <except>
+ <nsName ns=""/>
+ </except>
+ </anyName>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<foo/>
+</invalid>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <nsName ns=""/>
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<foo xmlns="http://www.example.com"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <nsName ns="http://www.example.com"/>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo xmlns="HTTP://www.example.com"/>
+</invalid>
+<invalid>
+<foo xmlns="http://www.example.com/"/>
+</invalid>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <nsName ns="http://www.example.com">
+ <except>
+ <name ns="http://www.example.com">foo</name>
+ </except>
+ </nsName>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo xmlns="http://www.example.com"/>
+</invalid>
+<valid>
+<bar xmlns="http://www.example.com"/>
+</valid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <nsName ns="http://www.example.com">
+ <except>
+ <name ns="">foo</name>
+ </except>
+ </nsName>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<bar/>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<valid>
+<bar xmlns="http://www.example.com"/>
+</valid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name ns="http://www.example.com">foo</name>
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo xmlns="http://www.example.com"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<bar xmlns="http://www.example.com"/>
+</invalid>
+<invalid>
+<foo xmlns="http://www.example.org"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name ns="">foo</name>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<foo xmlns="http://www.example.com"/>
+</invalid>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<bar xmlns="http://www.example.com"/>
+</invalid>
+<invalid>
+<bar/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.1</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <name ns="">foo</name>
+ <name ns="">bar</name>
+ </choice>
+ <empty/>
+</element>
+</correct>
+<invalid>
+<baz/>
+</invalid>
+<valid>
+<foo/>
+</valid>
+<valid>
+<bar/>
+</valid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2</section>
+<testSuite>
+<section>6.2.1</section>
+<testCase>
+<section>6.2.1</section>
+<correct>
+<choice xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="foo">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+</choice>
+</correct>
+<valid>
+<foo/>
+</valid>
+<valid>
+<bar/>
+</valid>
+<invalid>
+<baz/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.1</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <group>
+ <element name="bar1">
+ <empty/>
+ </element>
+ <element name="bar2">
+ <empty/>
+ </element>
+ </group>
+ <group>
+ <element name="bar1">
+ <empty/>
+ </element>
+ <element name="bar3">
+ <empty/>
+ </element>
+ </group>
+ </choice>
+</element>
+</correct>
+<valid>
+<foo><bar1/><bar2/></foo>
+</valid>
+<valid>
+<foo><bar1/><bar3/></foo>
+</valid>
+<invalid>
+<foo><bar1/></foo>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo><bar2/></foo>
+</invalid>
+<invalid>
+<foo><bar3/></foo>
+</invalid>
+<invalid>
+<foo><bar1/><bar2/><bar3/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.1</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <group>
+ <attribute name="bar1">
+ <text/>
+ </attribute>
+ <attribute name="bar2">
+ <text/>
+ </attribute>
+ </group>
+ <group>
+ <attribute name="bar1">
+ <text/>
+ </attribute>
+ <attribute name="bar3">
+ <text/>
+ </attribute>
+ </group>
+ </choice>
+</element>
+</correct>
+<valid>
+<foo bar1="x" bar2="x"/>
+</valid>
+<valid>
+<foo bar1="x" bar3="x"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo bar1="x"/>
+</invalid>
+<invalid>
+<foo bar2="x"/>
+</invalid>
+<invalid>
+<foo bar3="x"/>
+</invalid>
+<invalid>
+<foo bar1="x" bar2="x" bar3="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.1</section>
+<correct>
+<choice xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="foo">
+ <element name="bar">
+ <empty/>
+ </element>
+ </element>
+ <element name="foo">
+ <element name="baz">
+ <empty/>
+ </element>
+ </element>
+</choice>
+</correct>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo><baz/></foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo><foo/></foo>
+</invalid>
+<invalid>
+<bar/>
+</invalid>
+<invalid>
+<fobaz/>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.2</section>
+<testCase>
+<section>6.2.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="baz">
+ <empty/>
+ </element>
+ </group>
+</element>
+</correct>
+<valid>
+<foo><bar/><baz/></foo>
+</valid>
+<invalid>
+<foo><baz/><bar/></foo>
+</invalid>
+<invalid>
+<foo><bar/><baz/><bar/><baz/></foo>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo><baz/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ <attribute name="baz">
+ <text/>
+ </attribute>
+ </group>
+</element>
+</correct>
+<valid>
+<foo bar="x" baz="x"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ <attribute name="baz">
+ <text/>
+ </attribute>
+ </group>
+</element>
+</correct>
+<valid>
+<foo bar="x" baz="x"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo bar="x"/>
+</invalid>
+<invalid>
+<foo baz="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <attribute name="baz">
+ <text/>
+ </attribute>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ </group>
+</element>
+</correct>
+<valid>
+<foo bar="x" baz="x"/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo bar="x"/>
+</invalid>
+<invalid>
+<foo baz="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ <element name="baz">
+ <empty/>
+ </element>
+ </group>
+</element>
+</correct>
+<valid>
+<foo bar="x"><baz/></foo>
+</valid>
+<invalid>
+<foo><baz/></foo>
+</invalid>
+<invalid>
+<foo bar="x"/>
+</invalid>
+<invalid>
+<foo baz="x"><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.2</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <element name="baz">
+ <empty/>
+ </element>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ </group>
+</element>
+</correct>
+<valid>
+<foo bar="x"><baz/></foo>
+</valid>
+<invalid>
+<foo><baz/></foo>
+</invalid>
+<invalid>
+<foo bar="x"/>
+</invalid>
+<invalid>
+<foo baz="x"><bar/></foo>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.3</section>
+<testCase>
+<section>6.2.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <empty/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+<valid>
+<foo> </foo>
+</valid>
+<valid>
+<foo>
+
+
+</foo>
+</valid>
+<valid>
+<foo>
+<?target data?>
+<?target data?>
+<?target data?>
+<?target data?>
+</foo>
+</valid>
+<invalid>
+<foo>x</foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo bar="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar">
+ <empty/>
+ </attribute>
+</element>
+</correct>
+<valid><foo bar=""/></valid>
+<valid><foo bar=" "/></valid>
+<invalid><foo bar="x"/></invalid>
+</testCase>
+<testCase>
+<section>6.2.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <empty/>
+ </list>
+</element>
+</correct>
+<valid><foo/></valid>
+<valid><foo> </foo></valid>
+<invalid><foo>x</foo></invalid>
+<invalid><foo><bar/></foo></invalid>
+<invalid><foo bar=""/></invalid>
+</testCase>
+<testCase>
+<section>6.2.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar">
+ <list>
+ <empty/>
+ </list>
+ </attribute>
+</element>
+</correct>
+<valid><foo bar=""/></valid>
+<valid><foo bar=" "/></valid>
+<invalid><foo bar="x"/></invalid>
+</testCase>
+<testCase>
+<section>6.2.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <element name="bar">
+ <empty/>
+ </element>
+ <choice>
+ <empty/>
+ <element name="baz">
+ <empty/>
+ </element>
+ </choice>
+ </group>
+</element>
+</correct>
+<valid>
+<foo><bar/><baz/></foo>
+</valid>
+<valid>
+<foo><bar/></foo>
+</valid>
+<invalid>
+<foo></foo>
+</invalid>
+<invalid>
+<foo><bar/><baz/><baz/></foo>
+</invalid>
+</testCase>
+<testCase>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <empty/>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ </choice>
+</element>
+</correct>
+<valid>
+<foo bar="x"/>
+</valid>
+<valid>
+<foo/>
+</valid>
+<invalid>
+<foo baz="x"/>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.4</section>
+<testCase>
+<section>6.2.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <text/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+<valid>
+<foo> </foo>
+</valid>
+<valid>
+<foo>x</foo>
+</valid>
+<valid>
+<foo>
+x
+<?target data?>
+y
+</foo>
+</valid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <text/>
+ <element name="bar">
+ <empty/>
+ </element>
+ </group>
+</element>
+</correct>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo>
+<bar/>
+</foo>
+</valid>
+<valid>
+<foo>
+x
+<bar/>
+</foo>
+</valid>
+<valid>
+<foo>
+x
+<?target data?>
+y
+<bar/></foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo><bar/>x</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <group>
+ <element name="bar">
+ <empty/>
+ </element>
+ <text/>
+ </group>
+</element>
+</correct>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo>
+<bar/>
+</foo>
+</valid>
+<invalid>
+<foo>
+x
+<bar/>
+</foo>
+</invalid>
+<valid>
+<foo>
+<bar/>
+x
+<?target data?>
+y
+</foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<valid>
+<foo><bar/>x</foo>
+</valid>
+</testCase>
+<testCase>
+<section>6.2.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <text/>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo>
+<bar/>
+</foo>
+</valid>
+<valid>
+<foo>
+x
+<bar/>
+</foo>
+</valid>
+<valid>
+<foo>
+<bar/>
+x
+<?target data?>
+y
+</foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<valid>
+<foo><bar/>x</foo>
+</valid>
+<valid>
+<foo>x<bar/>x</foo>
+</valid>
+<invalid>
+<foo>x<bar/>x<bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar">
+ <text/>
+ </attribute>
+</element>
+</correct>
+<valid>
+<foo bar=""/>
+</valid>
+<valid>
+<foo bar="x"/>
+</valid>
+<valid>
+<foo bar=" "/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo><bar/>x<bar/></foo>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.5</section>
+<testCase>
+<section>6.2.5</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <element name="bar">
+ <empty/>
+ </element>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo><bar/><bar/></foo>
+</valid>
+<valid>
+<foo><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.5</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <group>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </group>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo><bar/><bar/></foo>
+</valid>
+<valid>
+<foo><bar/><bar/><bar/><bar/></foo>
+</valid>
+<valid>
+<foo><bar/><bar/><bar/><bar/><bar/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo><bar/><bar/><bar/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.5</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <nsName ns=""/>
+ <text/>
+ </attribute>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo x=""/>
+</valid>
+<valid>
+<foo x="" y=""/>
+</valid>
+<valid>
+<foo x="" y="" z=""/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo xmlns:ns="http://www.example.com" ns:x=""/>
+</invalid>
+<invalid>
+<foo x="" xmlns:ns="http://www.example.com" ns:x=""/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.5</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <choice>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ <element name="bar">
+ <text/>
+ </element>
+ </choice>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo bar=""><bar/><bar/></foo>
+</valid>
+<valid>
+<foo><bar/></foo>
+</valid>
+<valid>
+<foo bar=""/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.6</section>
+<testCase>
+<section>6.2.6</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="baz">
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo><bar/><baz/></foo>
+</valid>
+<valid>
+<foo><baz/><bar/></foo>
+</valid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo><baz/></foo>
+</invalid>
+<invalid>
+<foo><bar/><bar/></foo>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.6</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <group>
+ <element name="bar1">
+ <empty/>
+ </element>
+ <element name="bar2">
+ <empty/>
+ </element>
+ </group>
+ <element name="baz">
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo><baz/><bar1/><bar2/></foo>
+</valid>
+<valid>
+<foo><bar1/><baz/><bar2/></foo>
+</valid>
+<valid>
+<foo><bar1/><bar2/><baz/></foo>
+</valid>
+<invalid>
+<foo><baz/><bar2/><bar1/></foo>
+</invalid>
+<invalid>
+<foo><bar2/><bar1/></foo>
+</invalid>
+<invalid>
+<foo><baz/><bar2/><bar1/></foo>
+</invalid>
+<invalid>
+<foo><baz/><bar1/></foo>
+</invalid>
+<invalid>
+<foo><baz/><bar2/></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.6</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <attribute name="bar">
+ <text/>
+ </attribute>
+ <attribute name="baz">
+ <text/>
+ </attribute>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo bar="" baz=""/>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo bar=""/>
+</invalid>
+<invalid>
+<foo baz=""/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.6</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <attribute name="baz">
+ <text/>
+ </attribute>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo baz=""><bar/></foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo bar=""/>
+</invalid>
+<invalid>
+<foo bar=""><baz/><baz/></foo>
+</invalid>
+<invalid>
+<foo><baz/><baz/></foo>
+</invalid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.7</section>
+<testCase>
+<section>6.2.7</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name ns="">bar</name>
+ <value type="string" datatypeLibrary="">baz</value>
+ </attribute>
+</element>
+</correct>
+<valid>
+<foo bar="baz"/>
+</valid>
+<invalid>
+<foo bar=" baz"/>
+</invalid>
+<invalid>
+<foo bar="b"/>
+</invalid>
+<invalid>
+<foo bar=""/>
+</invalid>
+<invalid>
+<foo bar=" "/>
+</invalid>
+<invalid>
+<foo><bar>baz</bar></foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name ns="">bar</name>
+ <choice>
+ <value type="string" datatypeLibrary="">baz</value>
+ <empty/>
+ </choice>
+ </attribute>
+</element>
+</correct>
+<valid>
+<foo bar="baz"/>
+</valid>
+<valid>
+<foo bar=""/>
+</valid>
+<invalid>
+<foo bar=" baz"/>
+</invalid>
+<invalid>
+<foo bar="b"/>
+</invalid>
+<invalid>
+<foo><bar>baz</bar></foo>
+</invalid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute>
+ <name ns="">bar</name>
+ <value type="string"/>
+ </attribute>
+</element>
+</correct>
+<valid>
+<foo bar=""/>
+</valid>
+<invalid>
+<foo bar=" "/>
+</invalid>
+<invalid>
+<foo bar="x"/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0">
+ <name ns="">foo</name>
+ <group>
+ <element>
+ <name ns="">bar</name>
+ <empty/>
+ </element>
+ <element>
+ <name ns="">baz</name>
+ <empty/>
+ </element>
+ </group>
+</element>
+</correct>
+<valid>
+<foo><bar/><baz/></foo>
+</valid>
+<valid>
+<foo>
+<bar/>
+<baz/>
+</foo>
+</valid>
+<valid>
+<foo>
+<bar/>
+
+<baz/>
+</foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<bar><bar/><baz/></bar>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="string"/>
+</element>
+</correct>
+<valid><foo/></valid>
+<invalid><foo> </foo></invalid>
+<invalid><foo>x</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <value type="string"/>
+ <empty/>
+ </choice>
+</element>
+</correct>
+<valid><foo/></valid>
+<valid><foo> </foo></valid>
+<invalid><foo>x</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<section>6.2.8</section>
+<section>6.2.10</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <data type="token"/>
+ </list>
+</element>
+</correct>
+<invalid><foo/></invalid>
+<invalid><foo> </foo></invalid>
+<valid><foo>x</foo></valid>
+<valid><foo> x </foo></valid>
+<invalid><foo>x y</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<section>6.2.8</section>
+<requires datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"/>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <param name="minLength">2</param>
+ </data>
+</element>
+</correct>
+<valid><foo>xx</foo></valid>
+<valid><foo>xxx</foo></valid>
+<valid><foo> </foo></valid>
+<valid><foo> </foo></valid>
+<invalid><foo>x</foo></invalid>
+<invalid><foo> </foo></invalid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <value>x</value>
+ <element name="bar">
+ <empty/>
+ </element>
+ </choice>
+</element>
+</correct>
+<valid><foo> x </foo></valid>
+<valid><foo>x</foo></valid>
+<invalid><foo>y</foo></invalid>
+<valid><foo><bar/></foo></valid>
+<valid>
+<foo>
+<bar/>
+</foo>
+</valid>
+<invalid><foo>x<bar/></foo></invalid>
+<invalid><foo/></invalid>
+<invalid><foo><bar/>x</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.7</section>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <value>x</value>
+ <mixed>
+ <element name="bar">
+ <empty/>
+ </element>
+ </mixed>
+ </choice>
+</element>
+</correct>
+<valid><foo> x </foo></valid>
+<valid><foo>x</foo></valid>
+<invalid><foo>y</foo></invalid>
+<valid><foo><bar/></foo></valid>
+<valid>
+<foo>
+<bar/>
+</foo>
+</valid>
+<valid><foo>x<bar/></foo></valid>
+<invalid><foo/></invalid>
+<valid><foo><bar/>x</foo></valid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.8</section>
+<testCase>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string">
+ <except>
+ <choice>
+ <value>x</value>
+ <value>y</value>
+ </choice>
+ </except>
+ </data>
+</element>
+</correct>
+<valid>
+<foo>xyzzy</foo>
+</valid>
+<invalid>
+<foo>x</foo>
+</invalid>
+<invalid>
+<foo>y</foo>
+</invalid>
+<invalid>
+<foo> x</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string"/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value/>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>6.2.8</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string">
+ <except>
+ <value/>
+ </except>
+ </data>
+</element>
+</correct>
+<invalid>
+<foo/>
+</invalid>
+<valid>
+<foo>x</foo>
+</valid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.9</section>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string" datatypeLibrary=""/>
+</element>
+</correct>
+<valid>
+<foo>xyzzy</foo>
+</valid>
+<valid>
+<foo>
+x
+<?target data?>
+y
+<?target data?>
+z
+</foo>
+</valid>
+<valid>
+<foo></foo>
+</valid>
+<valid>
+<foo>
+</foo>
+</valid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo bar=""/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="token" datatypeLibrary=""/>
+</element>
+</correct>
+<valid>
+<foo>xyzzy</foo>
+</valid>
+<valid>
+<foo>
+x
+<?target data?>
+y
+<?target data?>
+z
+</foo>
+</valid>
+<valid>
+<foo></foo>
+</valid>
+<valid>
+<foo>
+</foo>
+</valid>
+<invalid>
+<foo><bar/></foo>
+</invalid>
+<invalid>
+<foo bar=""/>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="string" datatypeLibrary="">x</value>
+</element>
+</correct>
+<valid><foo>x</foo></valid>
+<invalid><foo>xy</foo></invalid>
+<invalid><foo> x</foo></invalid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="string" datatypeLibrary=""> x</value>
+</element>
+</correct>
+<valid><foo> x</foo></valid>
+<invalid><foo> xy</foo></invalid>
+<invalid><foo>x</foo></invalid>
+<invalid><foo/></invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="token" datatypeLibrary="">x</value>
+</element>
+</correct>
+<valid><foo>x</foo></valid>
+<valid><foo> x</foo></valid>
+<valid><foo>x </foo></valid>
+<valid><foo>

	 x

	 </foo></valid>
+<invalid><foo/></invalid>
+<invalid><foo>xy</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="token" datatypeLibrary="">x y</value>
+</element>
+</correct>
+<valid><foo>x y</foo></valid>
+<valid><foo> x y </foo></valid>
+<valid><foo>x

	 y</foo></valid>
+<invalid><foo>xy</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="token" datatypeLibrary="">

	 x

	 </value>
+</element>
+</correct>
+<valid><foo>x</foo></valid>
+<valid><foo> x</foo></valid>
+<valid><foo>x </foo></valid>
+<valid><foo>
	x 
</foo></valid>
+<invalid><foo/></invalid>
+<invalid><foo>xy</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="token" datatypeLibrary="">x

	 y</value>
+</element>
+</correct>
+<valid><foo>x y</foo></valid>
+<valid><foo>x y</foo></valid>
+<valid><foo> x y </foo></valid>
+<valid><foo>x
	y</foo></valid>
+<valid><foo>x 
y</foo></valid>
+<invalid><foo/></invalid>
+<invalid><foo>xy</foo></invalid>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="decimal" datatypeLibrary=""/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <value type="decimal" datatypeLibrary=""/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="string" datatypeLibrary="">
+ <param name="length">2</param>
+ </data>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>6.2.9</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <data type="token" datatypeLibrary="">
+ <param name="length">2</param>
+ </data>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>6.2.10</section>
+<testCase>
+<section>6.2.10</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <value type="string">x</value>
+ </list>
+</element>
+</correct>
+<valid>
+<foo>x</foo>
+</valid>
+<valid>
+<foo> x </foo>
+</valid>
+<invalid>
+<foo>x x</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.10</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <oneOrMore>
+ <value type="string">x</value>
+ </oneOrMore>
+ </list>
+</element>
+</correct>
+<valid>
+<foo>x</foo>
+</valid>
+<valid>
+<foo> x x x x </foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo>x y</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.10</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <group>
+ <value type="string">x</value>
+ <value type="string">y</value>
+ </group>
+ </list>
+</element>
+</correct>
+<valid>
+<foo>x y</foo>
+</valid>
+<valid>
+<foo>x y</foo>
+</valid>
+<valid>
+<foo>
x
y	</foo>
+</valid>
+<invalid>
+<foo>x</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.10</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <group>
+ <data type="token"/>
+ <data type="token"/>
+ </group>
+ </list>
+</element>
+</correct>
+<valid>
+<foo>x y</foo>
+</valid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo>x y z</foo>
+</invalid>
+</testCase>
+<testCase>
+<section>6.2.10</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <list>
+ <value>x y</value>
+ </list>
+</element>
+</correct>
+<invalid>
+<foo>x y</foo>
+</invalid>
+</testCase>
+</testSuite>
+</testSuite>
+</testSuite>
+<testSuite>
+<section>7</section>
+<testSuite>
+<section>7.1</section>
+<testCase>
+<section>7.1.1</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <attribute name="bar">
+ <element name="baz">
+ <empty/>
+ </element>
+ </attribute>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.1</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <attribute name="bar">
+ <choice>
+ <element name="baz">
+ <empty/>
+ </element>
+ <text/>
+ </choice>
+ </attribute>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.1</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <attribute name="bar">
+ <attribute name="baz"/>
+ </attribute>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.1</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <attribute name="bar">
+ <choice>
+ <attribute name="baz"/>
+ <text/>
+ </choice>
+ </attribute>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <group>
+ <attribute name="bar"/>
+ <attribute name="baz"/>
+ </group>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <group>
+ <attribute>
+ <anyName/>
+ </attribute>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </group>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <choice>
+ <group>
+ <choice>
+ <attribute name="bar"/>
+ <attribute name="baz"/>
+ </choice>
+ <choice>
+ <attribute name="bar"/>
+ <attribute name="baz"/>
+ </choice>
+ </group>
+ <attribute name="bar"/>
+ </choice>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <interleave>
+ <attribute name="bar"/>
+ <attribute name="baz"/>
+ </interleave>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <interleave>
+ <attribute>
+ <anyName/>
+ </attribute>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </interleave>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <choice>
+ <interleave>
+ <choice>
+ <attribute name="bar"/>
+ <attribute name="baz"/>
+ </choice>
+ <choice>
+ <attribute name="bar"/>
+ <attribute name="baz"/>
+ </choice>
+ </interleave>
+ <attribute name="bar"/>
+ </choice>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <list>
+ <data type="token"/>
+ </list>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <choice>
+ <list>
+ <data type="token"/>
+ </list>
+ <data type="token"/>
+ </choice>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <element name="bar">
+ <empty/>
+ </element>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <choice>
+ <data type="token"/>
+ <element name="bar">
+ <empty/>
+ </element>
+ </choice>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <attribute name="bar">
+ <empty/>
+ </attribute>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <choice>
+ <attribute name="bar">
+ <empty/>
+ </attribute>
+ <data type="token"/>
+ </choice>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <choice>
+ <text/>
+ <data type="token"/>
+ </choice>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <interleave>
+ <value>x</value>
+ <value>y</value>
+ </interleave>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.3</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <list>
+ <choice>
+ <interleave>
+ <value>x</value>
+ <value>y</value>
+ </interleave>
+ <value>z</value>
+ </choice>
+ </list>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <attribute name="bar"/>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <element name="bar">
+ <empty/>
+ </element>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <text/>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <list>
+ <data type="token"/>
+ </list>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <group>
+ <data type="token"/>
+ <data type="token"/>
+ </group>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <interleave>
+ <data type="token"/>
+ <data type="token"/>
+ </interleave>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <oneOrMore>
+ <data type="token"/>
+ </oneOrMore>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.4</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <data type="string">
+ <except>
+ <empty/>
+ </except>
+ </data>
+ </element>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <attribute name="foo"/>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <data type="string"/>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <data type="string"/>
+ <element name="foo">
+ <empty/>
+ </element>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <value>foo</value>
+ <element name="foo">
+ <empty/>
+ </element>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <text/>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <text/>
+ <element name="foo">
+ <empty/>
+ </element>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <list>
+ <data type="token"/>
+ </list>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <list>
+ <data type="token"/>
+ </list>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <group>
+ <element name="foo">
+ <empty/>
+ </element>
+ <element name="foo">
+ <empty/>
+ </element>
+ </group>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <group>
+ <element name="foo">
+ <empty/>
+ </element>
+ <element name="foo">
+ <empty/>
+ </element>
+ </group>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <interleave>
+ <element name="foo">
+ <empty/>
+ </element>
+ <element name="foo">
+ <empty/>
+ </element>
+ </interleave>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <interleave>
+ <element name="foo">
+ <empty/>
+ </element>
+ <element name="foo">
+ <empty/>
+ </element>
+ </interleave>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <oneOrMore>
+ <element name="foo">
+ <empty/>
+ </element>
+ </oneOrMore>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <oneOrMore>
+ <element name="foo">
+ <empty/>
+ </element>
+ </oneOrMore>
+ <element name="foo">
+ <empty/>
+ </element>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <empty/>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <choice>
+ <element name="foo">
+ <empty/>
+ </element>
+ <empty/>
+ </choice>
+</start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<section>7</section>
+<section>4.18</section>
+<documentation>Tests that constraints are post-normalization</documentation>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <grammar>
+ <start>
+ <text/>
+ </start>
+ </grammar>
+</element>
+</correct>
+<valid>
+<foo>text</foo>
+</valid>
+</testCase>
+<testCase>
+<section>7.1.5</section>
+<section>7</section>
+<section>4.18</section>
+<incorrect>
+<text xmlns="http://relaxng.org/ns/structure/1.0"/>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.1.1</section>
+<section>7</section>
+<section>4.20</section>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <optional>
+ <attribute name="bar">
+ <group>
+ <notAllowed/>
+ <attribute name="baz"/>
+ </group>
+ </attribute>
+ </optional>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>7.1.1</section>
+<section>7</section>
+<section>4.20</section>
+<documentation>The nested attribute element is normalized out because
+of the not allowed.</documentation>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <attribute name="bar">
+ <choice>
+ <text/>
+ <group>
+ <notAllowed/>
+ <attribute name="baz"/>
+ </group>
+ </choice>
+ </attribute>
+</element>
+</correct>
+<valid>
+<foo bar="baz"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<section>7</section>
+<section>4.12</section>
+<documentation>The group element is normalized out.</documentation>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <group>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </group>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</correct>
+<valid>
+<foo xyzzy1="val1" xyzzy2="val2"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<section>7</section>
+<section>4.21</section>
+<documentation>The group element is normalized out.</documentation>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <oneOrMore>
+ <group>
+ <attribute>
+ <anyName/>
+ </attribute>
+ <empty/>
+ </group>
+ </oneOrMore>
+ </element>
+</start>
+</grammar>
+</correct>
+<valid>
+<foo xyzzy1="val1" xyzzy2="val2"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.1.2</section>
+<section>7</section>
+<section>4.20</section>
+<documentation>The attribute elements are all normalized out.</documentation>
+<correct>
+<element xmlns="http://relaxng.org/ns/structure/1.0" name="foo">
+ <optional>
+ <attribute name="a1">
+ <attribute name="a2">
+ <attribute name="a3">
+ <notAllowed/>
+ </attribute>
+ </attribute>
+ </attribute>
+ </optional>
+</element>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+</testSuite>
+<testSuite>
+<section>7.2</section>
+<testCase>
+<section>7.2</section>
+<incorrect>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+ <start>
+ <element name="foo">
+ <group>
+ <data type="token"/>
+ <data type="token"/>
+ </group>
+ </element>
+ </start>
+</grammar>
+</incorrect>
+</testCase>
+<testCase>
+<documentation>Checks that normalization of notAllowed happens
+before string sequence checking.</documentation>
+<section>7.2</section>
+<section>4.20</section>
+<correct>
+<choice xmlns="http://relaxng.org/ns/structure/1.0">
+ <element name="foo">
+ <empty/>
+ </element>
+ <group>
+ <notAllowed/>
+ <element name="bar">
+ <group>
+ <data type="token"/>
+ <data type="token"/>
+ </group>
+ </element>
+ </group>
+</choice>
+</correct>
+<valid>
+<foo/>
+</valid>
+</testCase>
+<testCase>
+<section>4.20</section>
+<section>7.2</section>
+<documentation>notAllowed in an element is not normalized</documentation>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <group>
+ <element name="bar">
+ <notAllowed/>
+ </element>
+ <data type="token"/>
+ <data type="token"/>
+ </group>
+ <element name="baz">
+ <empty/>
+ </element>
+ </choice>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>7.3</section>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <attribute name="bar"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <zeroOrMore>
+ <attribute name="bar"/>
+ </zeroOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute name="bar"/>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo bar="xx"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <attribute name="bar"/>
+ <attribute name="bar"/>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <optional>
+ <attribute name="bar"/>
+ </optional>
+ <optional>
+ <attribute name="bar"/>
+ </optional>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <oneOrMore>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <oneOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <name>baz</name>
+ </except>
+ </anyName>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <oneOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <name>bar</name>
+ </except>
+ </anyName>
+ </attribute>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo bar="val" xyzzy="anotherval"/>
+</valid>
+<valid>
+<foo bar="val" baz=""/>
+</valid>
+<invalid>
+<foo bar="val"/>
+</invalid>
+<invalid>
+<foo/>
+</invalid>
+<invalid>
+<foo xyzzy="val"/>
+</invalid>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <oneOrMore>
+ <attribute>
+ <nsName ns=""/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <oneOrMore>
+ <attribute>
+ <nsName ns="">
+ <except>
+ <name>baz</name>
+ </except>
+ </nsName>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </oneOrMore>
+ <oneOrMore>
+ <attribute>
+ <nsName ns=""/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </oneOrMore>
+ <oneOrMore>
+ <attribute>
+ <anyName/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <nsName ns=""/>
+ </attribute>
+ </oneOrMore>
+ <oneOrMore>
+ <attribute>
+ <nsName ns="">
+ <except>
+ <name>bar</name>
+ </except>
+ </nsName>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <nsName>
+ <except>
+ <name>foo</name>
+ </except>
+ </nsName>
+ </except>
+ </anyName>
+ </attribute>
+ </oneOrMore>
+ <attribute name="foo"/>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <nsName>
+ <except>
+ <name>foo</name>
+ </except>
+ </nsName>
+ </except>
+ </anyName>
+ </attribute>
+ </oneOrMore>
+ <oneOrMore>
+ <attribute>
+ <nsName/>
+ </attribute>
+ </oneOrMore>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <anyName>
+ <except>
+ <nsName>
+ <except>
+ <name>bar</name>
+ </except>
+ </nsName>
+ </except>
+ </anyName>
+ </attribute>
+ </oneOrMore>
+ <attribute name="baz"/>
+</element>
+</correct>
+<valid>
+<foo bar="xx" baz="yy"/>
+</valid>
+<invalid>
+<foo x="xx" baz="yy"/>
+</invalid>
+<valid>
+<foo xmlns:eg="http://www.example.com/" eg:x="xx" baz="yy"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <oneOrMore>
+ <attribute>
+ <nsName ns="http://www.example.com/1"/>
+ </attribute>
+ </oneOrMore>
+ <oneOrMore>
+ <attribute>
+ <nsName ns="http://www.example.com/2"/>
+ </attribute>
+ </oneOrMore>
+</element>
+</correct>
+<valid>
+<foo xmlns:eg1="http://www.example.com/1"
+ xmlns:eg2="http://www.example.com/2"
+ eg1:x="xx" eg2:y="yy"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.3</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <choice>
+ <attribute name="bar"/>
+ <attribute name="bar"/>
+ </choice>
+</element>
+</correct>
+<valid>
+<foo bar="xx"/>
+</valid>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute name="bar"/>
+ <choice>
+ <attribute name="baz"/>
+ <attribute name="bar"/>
+ </choice>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute><anyName/><text/></attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute><nsName ns =""/><text/></attribute>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.3</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <attribute><choice><nsName ns =""/><name>foo</name></choice><text/></attribute>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+<testSuite>
+<section>7.4</section>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <interleave>
+ <element name="baz">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </interleave>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <group>
+ <element name="baz">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </group>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <group>
+ <element name="baz">
+ <empty/>
+ </element>
+ <interleave>
+ <element name="baz">
+ <empty/>
+ </element>
+ <element name="bar">
+ <empty/>
+ </element>
+ </interleave>
+ </group>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <optional>
+ <element name="bar">
+ <empty/>
+ </element>
+ </optional>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element>
+ <nsName ns=""/>
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element>
+ <anyName/>
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <notAllowed/>
+ </element>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element>
+ <anyName>
+ <except>
+ <name>bar</name>
+ </except>
+ </anyName>
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo><bar/><baz/></foo>
+</valid>
+</testCase>
+<testCase>
+<section>7.4</section>
+<correct>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <choice>
+ <element name="bar">
+ <empty/>
+ </element>
+ <element name="bar">
+ <text/>
+ </element>
+ </choice>
+ <element name="baz">
+ <empty/>
+ </element>
+ </interleave>
+</element>
+</correct>
+<valid>
+<foo><bar/><baz/></foo>
+</valid>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <interleave>
+ <text/>
+ <text/>
+ </interleave>
+</element>
+</incorrect>
+</testCase>
+<testCase>
+<section>7.4</section>
+<incorrect>
+<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
+ <mixed>
+ <mixed>
+ <element name="bar">
+ <empty/>
+ </element>
+ </mixed>
+ <element name="baz">
+ <empty/>
+ </element>
+ </mixed>
+</element>
+</incorrect>
+</testCase>
+</testSuite>
+</testSuite>
+<testSuite>
+<documentation>Regressions</documentation>
+<testCase>
+<correct>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0">
+<start>
+ <element name="foo">
+ <choice>
+ <group>
+ <attribute name="bar"><empty/></attribute>
+ <element name="baz1"><empty/></element>
+ </group>
+ <group>
+ <attribute name="bar"><text/></attribute>
+ <element name="baz2"><empty/></element>
+ </group>
+ </choice>
+ </element>
+</start>
+</grammar>
+</correct>
+<valid>
+<foo bar=" "><baz1/></foo>
+</valid>
+</testCase>
+<testCase>
+<correct>
+<notAllowed xmlns="http://relaxng.org/ns/structure/1.0"/>
+</correct>
+<invalid>
+<foo/>
+</invalid>
+</testCase>
+</testSuite>
+</testSuite>