1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-13 13:17:36 +03:00

more work on grammars and refs/defs augmented/updated the regression tests

* relaxng: more work on grammars and refs/defs
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
This commit is contained in:
Daniel Veillard 2003-02-03 23:22:49 +00:00
parent 144fae1635
commit 419a7688d0
46 changed files with 350 additions and 115 deletions

View File

@ -1,3 +1,9 @@
Tue Feb 4 00:20:58 CET 2003 Daniel Veillard <daniel@veillard.com>
* relaxng: more work on grammars and refs/defs
* test/relaxng/* result/relaxng/*: augmented/updated the
regression tests
Mon Feb 3 14:16:59 CET 2003 Daniel Veillard <daniel@veillard.com>
* relaxng: more work on name classes, except support

231
relaxng.c
View File

@ -105,6 +105,7 @@ typedef enum {
XML_RELAXNG_DEF, /* a definition */
XML_RELAXNG_REF, /* reference to a definition */
XML_RELAXNG_EXTERNALREF, /* reference to an external def */
XML_RELAXNG_PARENTREF, /* reference to a def in the parent grammar */
XML_RELAXNG_OPTIONAL, /* optional patterns */
XML_RELAXNG_ZEROORMORE, /* zero or more non empty patterns */
XML_RELAXNG_ONEORMORE, /* one or more non empty patterns */
@ -140,8 +141,10 @@ struct _xmlRelaxNG {
xmlHashTablePtr defs; /* define */
xmlHashTablePtr refs; /* references */
xmlHashTablePtr documents; /* all the documents loaded */
xmlHashTablePtr includes; /* all the includes loaded */
xmlHashTablePtr documents; /* all the documents loaded */
xmlHashTablePtr includes; /* all the includes loaded */
int defNr; /* number of defines used */
xmlRelaxNGDefinePtr *defTab;/* pointer to the allocated definitions */
void *_private; /* unused by the library for users or bindings */
};
@ -161,6 +164,7 @@ struct _xmlRelaxNGParserCtxt {
xmlRelaxNGPtr schema; /* The schema in use */
xmlRelaxNGGrammarPtr grammar; /* the current grammar */
xmlRelaxNGGrammarPtr parentgrammar;/* the parent grammar */
int flags; /* parser flags */
int nbErrors; /* number of errors at parse time */
int nbWarnings; /* number of warnings at parse time */
@ -175,6 +179,10 @@ struct _xmlRelaxNGParserCtxt {
xmlChar *URL;
xmlDocPtr document;
int defNr; /* number of defines used */
int defMax; /* number of defines aloocated */
xmlRelaxNGDefinePtr *defTab; /* pointer to the allocated definitions */
const char *buffer;
int size;
@ -337,7 +345,6 @@ struct _xmlRelaxNGTypeLibrary {
* Allocation functions *
* *
************************************************************************/
static void xmlRelaxNGFreeDefineList(xmlRelaxNGDefinePtr defines);
static void xmlRelaxNGFreeGrammar(xmlRelaxNGGrammarPtr grammar);
static void xmlRelaxNGFreeDefine(xmlRelaxNGDefinePtr define);
@ -430,6 +437,13 @@ xmlRelaxNGFree(xmlRelaxNGPtr schema)
if (schema->includes != NULL)
xmlHashFree(schema->includes, (xmlHashDeallocator)
xmlRelaxNGFreeInclude);
if (schema->defTab != NULL) {
int i;
for (i = 0;i < schema->defNr;i++)
xmlRelaxNGFreeDefine(schema->defTab[i]);
xmlFree(schema->defTab);
}
xmlFree(schema);
}
@ -459,24 +473,6 @@ xmlRelaxNGNewGrammar(xmlRelaxNGParserCtxtPtr ctxt)
return (ret);
}
/**
* xmlRelaxNGFreeDefineHash:
* @defines: a list of define structures
*
* Deallocate a RelaxNG definition in the hash table
*/
static void
xmlRelaxNGFreeDefineHash(xmlRelaxNGDefinePtr defines)
{
xmlRelaxNGDefinePtr next;
while (defines != NULL) {
next = defines->nextHash;
xmlRelaxNGFreeDefine(defines);
defines = next;
}
}
/**
* xmlRelaxNGFreeGrammar:
* @grammar: a grammar structure
@ -489,14 +485,14 @@ xmlRelaxNGFreeGrammar(xmlRelaxNGGrammarPtr grammar)
if (grammar == NULL)
return;
if (grammar->start != NULL)
xmlRelaxNGFreeDefine(grammar->start);
if (grammar->next != NULL) {
xmlRelaxNGFreeGrammar(grammar->next);
}
if (grammar->refs != NULL) {
xmlHashFree(grammar->refs, NULL);
}
if (grammar->defs != NULL) {
xmlHashFree(grammar->defs, (xmlHashDeallocator)
xmlRelaxNGFreeDefineHash);
xmlHashFree(grammar->defs, NULL);
}
xmlFree(grammar);
@ -516,37 +512,43 @@ xmlRelaxNGNewDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
{
xmlRelaxNGDefinePtr ret;
if (ctxt->defMax == 0) {
ctxt->defMax = 16;
ctxt->defNr = 0;
ctxt->defTab = (xmlRelaxNGDefinePtr *)
xmlMalloc(ctxt->defMax * sizeof(xmlRelaxNGDefinePtr));
if (ctxt->defTab == NULL) {
if ((ctxt != NULL) && (ctxt->error != NULL))
ctxt->error(ctxt->userData, "Out of memory\n");
ctxt->nbErrors++;
return (NULL);
}
} else if (ctxt->defMax <= ctxt->defNr) {
xmlRelaxNGDefinePtr *tmp;
ctxt->defMax *= 2;
tmp = (xmlRelaxNGDefinePtr *) xmlRealloc(ctxt->defTab,
ctxt->defMax * sizeof(xmlRelaxNGDefinePtr));
if (tmp == NULL) {
if ((ctxt != NULL) && (ctxt->error != NULL))
ctxt->error(ctxt->userData, "Out of memory\n");
ctxt->nbErrors++;
return (NULL);
}
ctxt->defTab = tmp;
}
ret = (xmlRelaxNGDefinePtr) xmlMalloc(sizeof(xmlRelaxNGDefine));
if (ret == NULL) {
if ((ctxt != NULL) && (ctxt->error != NULL))
ctxt->error(ctxt->userData, "Out of memory\n");
if ((ctxt != NULL) && (ctxt->error != NULL))
ctxt->error(ctxt->userData, "Out of memory\n");
ctxt->nbErrors++;
return (NULL);
return(NULL);
}
memset(ret, 0, sizeof(xmlRelaxNGDefine));
ctxt->defTab[ctxt->defNr++] = ret;
ret->node = node;
return (ret);
}
/**
* xmlRelaxNGFreeDefineList:
* @defines: a list of define structures
*
* Deallocate a RelaxNG define structures.
*/
static void
xmlRelaxNGFreeDefineList(xmlRelaxNGDefinePtr defines)
{
xmlRelaxNGDefinePtr next;
while (defines != NULL) {
next = defines->next;
xmlRelaxNGFreeDefine(defines);
defines = next;
}
}
/**
* xmlRelaxNGFreePartition:
* @partitions: a partition set structure
@ -585,23 +587,15 @@ xmlRelaxNGFreeDefine(xmlRelaxNGDefinePtr define)
if (define == NULL)
return;
if ((define->data != NULL) &&
(define->type == XML_RELAXNG_INTERLEAVE))
xmlRelaxNGFreePartition((xmlRelaxNGPartitionPtr) define->data);
if (define->name != NULL)
xmlFree(define->name);
if (define->ns != NULL)
xmlFree(define->ns);
if (define->value != NULL)
xmlFree(define->value);
if (define->attrs != NULL)
xmlRelaxNGFreeDefineList(define->attrs);
if ((define->content != NULL) &&
(define->type != XML_RELAXNG_REF) &&
(define->type != XML_RELAXNG_EXTERNALREF))
xmlRelaxNGFreeDefineList(define->content);
if (define->nameClass != NULL)
xmlRelaxNGFreeDefineList(define->nameClass);
if ((define->data != NULL) &&
(define->type == XML_RELAXNG_INTERLEAVE))
xmlRelaxNGFreePartition((xmlRelaxNGPartitionPtr) define->data);
xmlFree(define);
}
@ -1572,6 +1566,8 @@ static int xmlRelaxNGParseGrammarContent(
static xmlRelaxNGDefinePtr xmlRelaxNGParseNameClass(
xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
xmlRelaxNGDefinePtr def);
static xmlRelaxNGGrammarPtr xmlRelaxNGParseGrammar(
xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes);
#define IS_BLANK_NODE(n) \
@ -2202,7 +2198,6 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
"Could not create definition hash\n");
ctxt->nbErrors++;
ret = -1;
xmlRelaxNGFreeDefine(def);
} else {
tmp = xmlHashAddEntry(ctxt->grammar->defs, name, def);
if (tmp < 0) {
@ -2216,7 +2211,6 @@ xmlRelaxNGParseDefine(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
name);
ctxt->nbErrors++;
ret = -1;
xmlRelaxNGFreeDefine(def);
} else {
while (prev->nextHash != NULL)
prev = prev->nextHash;
@ -2325,7 +2319,6 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
ctxt->error(ctxt->userData,
"Could not create references hash\n");
ctxt->nbErrors++;
xmlRelaxNGFreeDefine(def);
def = NULL;
} else {
int tmp;
@ -2342,7 +2335,6 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
"Internal error refs definitions '%s'\n",
def->name);
ctxt->nbErrors++;
xmlRelaxNGFreeDefine(def);
def = NULL;
} else {
def->nextHash = prev->nextHash;
@ -2410,6 +2402,81 @@ xmlRelaxNGParsePattern(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
"xmlRelaxNGParse: notAllowed element is not empty\n");
ctxt->nbErrors++;
}
} else if (IS_RELAXNG(node, "grammar")) {
xmlRelaxNGGrammarPtr grammar, old;
xmlRelaxNGGrammarPtr oldparent;
oldparent = ctxt->parentgrammar;
old = ctxt->grammar;
ctxt->parentgrammar = old;
grammar = xmlRelaxNGParseGrammar(ctxt, node->children);
if (old != NULL) {
ctxt->grammar = old;
ctxt->parentgrammar = oldparent;
if (grammar != NULL) {
grammar->next = old->next;
old->next = grammar;
}
}
if (grammar != NULL)
def = grammar->start;
else
def = NULL;
} else if (IS_RELAXNG(node, "parentRef")) {
if (ctxt->parentgrammar == NULL) {
if (ctxt->error != NULL)
ctxt->error(ctxt->userData,
"Use of parentRef without a parent grammar\n");
ctxt->nbErrors++;
return(NULL);
}
def = xmlRelaxNGNewDefine(ctxt, node);
if (def == NULL)
return(NULL);
def->type = XML_RELAXNG_PARENTREF;
def->name = xmlGetProp(node, BAD_CAST "name");
if (def->name == NULL) {
if (ctxt->error != NULL)
ctxt->error(ctxt->userData,
"parentRef has no name\n");
ctxt->nbErrors++;
}
if (node->children != NULL) {
if (ctxt->error != NULL)
ctxt->error(ctxt->userData,
"parentRef is not empty\n");
ctxt->nbErrors++;
}
if (ctxt->parentgrammar->refs == NULL)
ctxt->parentgrammar->refs = xmlHashCreate(10);
if (ctxt->parentgrammar->refs == NULL) {
if (ctxt->error != NULL)
ctxt->error(ctxt->userData,
"Could not create references hash\n");
ctxt->nbErrors++;
def = NULL;
} else {
int tmp;
tmp = xmlHashAddEntry(ctxt->parentgrammar->refs, def->name, def);
if (tmp < 0) {
xmlRelaxNGDefinePtr prev;
prev = (xmlRelaxNGDefinePtr)
xmlHashLookup(ctxt->parentgrammar->refs, def->name);
if (prev == NULL) {
if (ctxt->error != NULL)
ctxt->error(ctxt->userData,
"Internal error parentRef definitions '%s'\n",
def->name);
ctxt->nbErrors++;
def = NULL;
} else {
def->nextHash = prev->nextHash;
prev->nextHash = def;
}
}
}
} else {
TODO
def = NULL;
@ -2465,6 +2532,7 @@ xmlRelaxNGParseAttribute(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
case XML_RELAXNG_VALUE:
case XML_RELAXNG_LIST:
case XML_RELAXNG_REF:
case XML_RELAXNG_PARENTREF:
case XML_RELAXNG_EXTERNALREF:
case XML_RELAXNG_DEF:
case XML_RELAXNG_ONEORMORE:
@ -2547,9 +2615,7 @@ xmlRelaxNGParseExceptNameClass(xmlRelaxNGParserCtxtPtr ctxt,
else
cur->type = XML_RELAXNG_ELEMENT;
if (xmlRelaxNGParseNameClass(ctxt, child, cur) == NULL) {
xmlRelaxNGFreeDefine(cur);
} else {
if (xmlRelaxNGParseNameClass(ctxt, child, cur) != NULL) {
if (last == NULL) {
ret->content = cur;
} else {
@ -2674,6 +2740,7 @@ xmlRelaxNGParseElement(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node) {
case XML_RELAXNG_VALUE:
case XML_RELAXNG_LIST:
case XML_RELAXNG_REF:
case XML_RELAXNG_PARENTREF:
case XML_RELAXNG_EXTERNALREF:
case XML_RELAXNG_DEF:
case XML_RELAXNG_ZEROORMORE:
@ -2749,13 +2816,14 @@ xmlRelaxNGParsePatterns(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes,
cur->parent = parent;
} else {
cur = xmlRelaxNGParsePattern(ctxt, nodes);
if (def == NULL) {
def = last = cur;
} else {
last->next = cur;
last = cur;
if (cur != NULL) {
if (def == NULL) {
def = last = cur;
} else {
last->next = cur;
last = cur;
}
}
cur->parent = parent;
}
nodes = nodes->next;
}
@ -3321,6 +3389,13 @@ xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxtPtr ctxt) {
xmlFree(ctxt->docTab);
if (ctxt->incTab != NULL)
xmlFree(ctxt->incTab);
if (ctxt->defTab != NULL) {
int i;
for (i = 0;i < ctxt->defNr;i++)
xmlRelaxNGFreeDefine(ctxt->defTab[i]);
xmlFree(ctxt->defTab);
}
xmlFree(ctxt);
}
@ -3746,6 +3821,9 @@ xmlRelaxNGParse(xmlRelaxNGParserCtxtPtr ctxt)
ctxt->documents = NULL;
ret->includes = ctxt->includes;
ctxt->includes = NULL;
ret->defNr = ctxt->defNr;
ret->defTab = ctxt->defTab;
ctxt->defTab = NULL;
return (ret);
}
@ -3880,6 +3958,14 @@ xmlRelaxNGDumpDefine(FILE * output, xmlRelaxNGDefinePtr define) {
xmlRelaxNGDumpDefines(output, define->content);
fprintf(output, "</ref>\n");
break;
case XML_RELAXNG_PARENTREF:
fprintf(output, "<parentRef");
if (define->name != NULL)
fprintf(output, " name=\"%s\"", define->name);
fprintf(output, ">\n");
xmlRelaxNGDumpDefines(output, define->content);
fprintf(output, "</parentRef>\n");
break;
case XML_RELAXNG_EXTERNALREF:
fprintf(output, "<externalRef");
xmlRelaxNGDumpDefines(output, define->content);
@ -5081,8 +5167,9 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
case XML_RELAXNG_ATTRIBUTE:
ret = xmlRelaxNGValidateAttribute(ctxt, define);
break;
case XML_RELAXNG_EXTERNALREF:
case XML_RELAXNG_REF:
case XML_RELAXNG_PARENTREF:
case XML_RELAXNG_EXTERNALREF:
ret = xmlRelaxNGValidateDefinition(ctxt, define->content);
break;
case XML_RELAXNG_DATATYPE: {

View File

@ -1,2 +1,2 @@
error detected at relaxng.c:4920
error detected at relaxng.c:5223
error detected at relaxng.c:5006
error detected at relaxng.c:5310

View File

@ -1,2 +1,2 @@
error detected at relaxng.c:4925
error detected at relaxng.c:5223
error detected at relaxng.c:5011
error detected at relaxng.c:5310

View File

@ -1,2 +1,2 @@
error detected at relaxng.c:4925
error detected at relaxng.c:5223
error detected at relaxng.c:5011
error detected at relaxng.c:5310

View File

@ -1,2 +1,2 @@
error detected at relaxng.c:4932
error detected at relaxng.c:5223
error detected at relaxng.c:5018
error detected at relaxng.c:5310

View File

@ -1,2 +1,2 @@
error detected at relaxng.c:4932
error detected at relaxng.c:5223
error detected at relaxng.c:5018
error detected at relaxng.c:5310

View File

@ -1,5 +1,5 @@
xmlRelaxNGValidateAttribute(email): -1
xmlRelaxNGValidateAttribute(name): -1
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

View File

@ -1,5 +1,5 @@
xmlRelaxNGValidateAttribute(email): -1
xmlRelaxNGValidateAttribute(name): -1
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

View File

@ -1,4 +1,4 @@
xmlRelaxNGValidateAttribute(anyName): 0
xmlRelaxNGValidateAttribute(anyName): -1
error detected at relaxng.c:4968
error detected at relaxng.c:5054
xmlRelaxNGValidateDefinition(): validated card : -1

View File

@ -1,4 +1,4 @@
xmlRelaxNGValidateAttribute(anyName): 0
xmlRelaxNGValidateAttribute(anyName): -1
error detected at relaxng.c:4968
error detected at relaxng.c:5054
xmlRelaxNGValidateDefinition(): validated card : -1

View File

@ -0,0 +1 @@
./test/relaxng/tutor11_3_1.xml validates

View File

@ -0,0 +1,3 @@
xmlRelaxNGValidateAttribute(anyName): 0
xmlRelaxNGValidateAttribute(anyName): 0
xmlRelaxNGValidateDefinition(): validated example : 0

View File

@ -0,0 +1 @@
./test/relaxng/tutor11_4_1.xml validates

View File

@ -0,0 +1,4 @@
xmlRelaxNGValidateAttribute(anyName): 0
xmlRelaxNGValidateAttribute(anyName): -1
xmlRelaxNGValidateAttribute(space): 0
xmlRelaxNGValidateDefinition(): validated example : 0

View File

@ -0,0 +1 @@
./test/relaxng/tutor12_1_1.xml validates

View File

@ -0,0 +1,4 @@
xmlRelaxNGValidateDefinition(): validated name : 0
xmlRelaxNGValidateDefinition(): validated email : 0
xmlRelaxNGValidateDefinition(): validated card : 0
xmlRelaxNGValidateDefinition(): validated addressBook : 0

View File

@ -0,0 +1 @@
./test/relaxng/tutor13_1_1.xml validates

View File

@ -0,0 +1,9 @@
xmlRelaxNGValidateDefinition(): validated p : 0
xmlRelaxNGValidateDefinition(): validated em : 0
xmlRelaxNGValidateDefinition(): validated td : 0
xmlRelaxNGValidateDefinition(): validated tr : 0
xmlRelaxNGValidateDefinition(): validated td : 0
xmlRelaxNGValidateDefinition(): validated tr : 0
xmlRelaxNGValidateDefinition(): validated table : 0
xmlRelaxNGValidateDefinition(): validated p : 0
xmlRelaxNGValidateDefinition(): validated doc : 0

View File

@ -1,3 +1,3 @@
error detected at relaxng.c:4912
error detected at relaxng.c:4960
error detected at relaxng.c:4998
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated card : -1

View File

@ -1,4 +1,4 @@
xmlRelaxNGValidateDefinition(): validated email : 0
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

View File

@ -1,3 +1,3 @@
error detected at relaxng.c:5105
error detected at relaxng.c:5192
xmlRelaxNGValidateDefinition(): validated note : 0
xmlRelaxNGValidateDefinition(): validated bad : -1

View File

@ -1,5 +1,5 @@
xmlRelaxNGValidateAttribute(preferredFormat): -1
xmlRelaxNGValidateAttribute(email): 0
xmlRelaxNGValidateAttribute(name): 0
error detected at relaxng.c:4968
error detected at relaxng.c:5054
xmlRelaxNGValidateDefinition(): validated card : -1

View File

@ -1,5 +1,5 @@
xmlRelaxNGValidateDefinition(): validated name : 0
xmlRelaxNGValidateDefinition(): validated email : 0
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated preferredFormat : -1
xmlRelaxNGValidateDefinition(): validated card : -1

View File

@ -1,5 +1,5 @@
xmlRelaxNGValidateAttribute(preferredFormat): -1
xmlRelaxNGValidateAttribute(email): 0
xmlRelaxNGValidateAttribute(name): 0
error detected at relaxng.c:4968
error detected at relaxng.c:5054
xmlRelaxNGValidateDefinition(): validated card : -1

View File

@ -1,5 +1,5 @@
Unimplemented block at xmlschemastypes.c:1132
error detected at relaxng.c:4078
error detected at relaxng.c:5159
error detected at relaxng.c:4960
error detected at relaxng.c:4164
error detected at relaxng.c:5246
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated vector : -1

View File

@ -1,6 +1,6 @@
Unimplemented block at xmlschemastypes.c:1132
Unimplemented block at xmlschemastypes.c:1132
error detected at relaxng.c:4266
error detected at relaxng.c:5159
error detected at relaxng.c:4960
error detected at relaxng.c:4352
error detected at relaxng.c:5246
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated vector : -1

View File

@ -1,3 +1,3 @@
error detected at relaxng.c:4241
error detected at relaxng.c:5159
error detected at relaxng.c:4327
error detected at relaxng.c:5246
xmlRelaxNGValidateDefinition(): validated vector : -1

View File

@ -1,7 +1,7 @@
Unimplemented block at xmlschemastypes.c:1135
Unimplemented block at xmlschemastypes.c:1135
Unimplemented block at xmlschemastypes.c:1135
error detected at relaxng.c:4266
error detected at relaxng.c:5159
error detected at relaxng.c:4960
error detected at relaxng.c:4352
error detected at relaxng.c:5246
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated path : -1

View File

@ -1,5 +1,5 @@
Unimplemented block at xmlschemastypes.c:1135
error detected at relaxng.c:4078
error detected at relaxng.c:5159
error detected at relaxng.c:4960
error detected at relaxng.c:4164
error detected at relaxng.c:5246
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated path : -1

View File

@ -3,5 +3,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
6 groups
xmlRelaxNGValidateDefinition(): validated title : 0
xmlRelaxNGValidateDefinition(): validated title : 0
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated head : -1

View File

@ -1,6 +1,6 @@
xmlRelaxNGComputeInterleaves(interleave0)
6 child
6 groups
error detected at relaxng.c:4906
error detected at relaxng.c:4960
error detected at relaxng.c:4992
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated head : -1

View File

@ -4,5 +4,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
xmlRelaxNGValidateDefinition(): validated title : 0
xmlRelaxNGValidateDefinition(): validated base : 0
xmlRelaxNGValidateDefinition(): validated base : 0
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated head : -1

View File

@ -4,5 +4,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
2 groups
xmlRelaxNGValidateAttribute(name): 0
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

View File

@ -5,5 +5,5 @@ xmlRelaxNGComputeInterleaves(interleave0)
xmlRelaxNGValidateAttribute(name): 0
xmlRelaxNGValidateAttribute(email): 0
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

View File

@ -1,4 +1,4 @@
xmlRelaxNGValidateAttribute(name): 0
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

View File

@ -1,5 +1,5 @@
xmlRelaxNGValidateAttribute(name): 0
xmlRelaxNGValidateAttribute(email): 0
xmlRelaxNGValidateDefinition(): validated card : -1
error detected at relaxng.c:4960
error detected at relaxng.c:5046
xmlRelaxNGValidateDefinition(): validated addressBook : -1

21
test/relaxng/table.rng Normal file
View File

@ -0,0 +1,21 @@
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<define name="cell.content">
<notAllowed/>
</define>
<start>
<element name="table">
<oneOrMore>
<element name="tr">
<oneOrMore>
<element name="td">
<ref name="cell.content"/>
</element>
</oneOrMore>
</element>
</oneOrMore>
</element>
</start>
</grammar>

View File

@ -0,0 +1,15 @@
<element name="example" xmlns="http://relaxng.org/ns/structure/1.0">
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
<optional>
<attribute name="xml:space">
<choice>
<value>default</value>
<value>preserve</value>
</choice>
</attribute>
</optional>
</element>

View File

@ -0,0 +1 @@
<example foo="bar" xml:space="default"/>

View File

@ -0,0 +1,19 @@
<element name="example" xmlns="http://relaxng.org/ns/structure/1.0">
<zeroOrMore>
<attribute>
<anyName>
<except>
<name>xml:space</name>
</except>
</anyName>
</attribute>
</zeroOrMore>
<optional>
<attribute name="xml:space">
<choice>
<value>default</value>
<value>preserve</value>
</choice>
</attribute>
</optional>
</element>

View File

@ -0,0 +1 @@
<example foo="bar" xml:space="default"/>

View File

@ -0,0 +1,13 @@
<element name="addressBook" xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://www.example.com/annotation">
<zeroOrMore>
<element name="card">
<a:documentation>Information about a single email address.</a:documentation>
<element name="name">
<text/>
</element>
<element name="email">
<text/>
</element>
</element>
</zeroOrMore>
</element>

View File

@ -0,0 +1,3 @@
<addressBook>
<card><name>foo</name><email>bar</email></card>
</addressBook>

View File

@ -0,0 +1,33 @@
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<element name="doc">
<zeroOrMore>
<choice>
<element name="p">
<ref name="inline"/>
</element>
<grammar>
<include href="table.rng">
<define name="cell.content">
<parentRef name="inline"/>
</define>
</include>
</grammar>
</choice>
</zeroOrMore>
</element>
</start>
<define name="inline">
<zeroOrMore>
<choice>
<text/>
<element name="em">
<ref name="inline"/>
</element>
</choice>
</zeroOrMore>
</define>
</grammar>

View File

@ -0,0 +1,12 @@
<doc>
<p>start</p>
<table>
<tr>
<td> <em>hello</em> !</td>
</tr>
<tr>
<td></td>
</tr>
</table>
<p>end</p>
</doc>