mirror of
https://github.com/GNOME/libxml2.git
synced 2025-03-31 19:10:28 +08:00
more work on Relax-NG, implementing interleave augmented/updated the
* relaxng.c: more work on Relax-NG, implementing interleave * test/relaxng/* result/relaxng/*: augmented/updated the regression tests Daniel
This commit is contained in:
parent
76fc5edab6
commit
b08c9815d2
@ -1,3 +1,9 @@
|
||||
Wed Jan 29 00:08:38 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* relaxng.c: more work on Relax-NG, implementing interleave
|
||||
* test/relaxng/* result/relaxng/*: augmented/updated the
|
||||
regression tests
|
||||
|
||||
Tue Jan 28 21:56:49 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* relaxng.c: more work on Relax-NG, implementing interleave
|
||||
|
15
relaxng.c
15
relaxng.c
@ -42,7 +42,7 @@ static const xmlChar *xmlRelaxNGNs = (const xmlChar *)
|
||||
#define DEBUG_CONTENT 1
|
||||
#define DEBUG_TYPE 1
|
||||
#define DEBUG_VALID 1
|
||||
#define DEBUG_INTERLEAVE 1
|
||||
#define DEBUG_INTERLEAVE 1 */
|
||||
|
||||
#define UNBOUNDED (1 << 30)
|
||||
#define TODO \
|
||||
@ -1299,7 +1299,8 @@ xmlRelaxNGGetElements(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
parent = NULL;
|
||||
cur = def;
|
||||
while (cur != NULL) {
|
||||
if (cur->type == XML_RELAXNG_ELEMENT) {
|
||||
if ((cur->type == XML_RELAXNG_ELEMENT) ||
|
||||
(cur->type == XML_RELAXNG_TEXT)) {
|
||||
if (ret == NULL) {
|
||||
max = 10;
|
||||
ret = (xmlRelaxNGDefinePtr *)
|
||||
@ -1322,13 +1323,16 @@ xmlRelaxNGGetElements(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
ret[len++] = def;
|
||||
ret[len++] = cur;
|
||||
ret[len] = NULL;
|
||||
} else if ((cur->type == XML_RELAXNG_CHOICE) ||
|
||||
(cur->type == XML_RELAXNG_INTERLEAVE) ||
|
||||
(cur->type == XML_RELAXNG_GROUP) ||
|
||||
(cur->type == XML_RELAXNG_ONEORMORE) ||
|
||||
(cur->type == XML_RELAXNG_ZEROORMORE)) {
|
||||
(cur->type == XML_RELAXNG_ZEROORMORE) ||
|
||||
(cur->type == XML_RELAXNG_OPTIONAL) ||
|
||||
(cur->type == XML_RELAXNG_REF) ||
|
||||
(cur->type == XML_RELAXNG_DEF)) {
|
||||
/*
|
||||
* Don't go within elements or attributes or string values.
|
||||
* Just gather the element top list
|
||||
@ -3627,7 +3631,7 @@ static int
|
||||
xmlRelaxNGValidatePartGroup(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGInterleaveGroupPtr *groups,
|
||||
int nbgroups, xmlNodePtr *nodes, int len) {
|
||||
int level = -1, ret = -1, i, j, k;
|
||||
int level, ret = -1, i, j, k;
|
||||
xmlNodePtr *array = NULL, *list, oldseq;
|
||||
xmlRelaxNGInterleaveGroupPtr group;
|
||||
|
||||
@ -3662,6 +3666,7 @@ xmlRelaxNGValidatePartGroup(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
ctxt->state->seq = oldseq;
|
||||
if (k > 1) {
|
||||
memset(array, 0, k * sizeof(xmlNodePtr));
|
||||
level = -1;
|
||||
ret = xmlRelaxNGValidateWalkPermutations(ctxt, group->rule,
|
||||
list, array, k, &level, -1);
|
||||
} else {
|
||||
|
@ -1,3 +1,3 @@
|
||||
error detected at relaxng.c:3888
|
||||
error detected at relaxng.c:3936
|
||||
error detected at relaxng.c:3893
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||
|
@ -1,5 +1,5 @@
|
||||
xmlRelaxNGValidateAttribute(name): -1
|
||||
xmlRelaxNGValidateDefinition(): validated email : 0
|
||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||
error detected at relaxng.c:3936
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated addressBook : -1
|
||||
|
@ -1,3 +1,3 @@
|
||||
error detected at relaxng.c:4066
|
||||
error detected at relaxng.c:4071
|
||||
xmlRelaxNGValidateDefinition(): validated note : 0
|
||||
xmlRelaxNGValidateDefinition(): validated bad : -1
|
||||
|
@ -1,5 +1,5 @@
|
||||
xmlRelaxNGValidateAttribute(preferredFormat): -1
|
||||
xmlRelaxNGValidateAttribute(email): 0
|
||||
xmlRelaxNGValidateAttribute(name): 0
|
||||
error detected at relaxng.c:3944
|
||||
error detected at relaxng.c:3949
|
||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||
|
@ -1,5 +1,5 @@
|
||||
xmlRelaxNGValidateDefinition(): validated name : 0
|
||||
xmlRelaxNGValidateDefinition(): validated email : 0
|
||||
error detected at relaxng.c:3936
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated preferredFormat : -1
|
||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||
|
@ -1,5 +1,5 @@
|
||||
xmlRelaxNGValidateAttribute(preferredFormat): -1
|
||||
xmlRelaxNGValidateAttribute(email): 0
|
||||
xmlRelaxNGValidateAttribute(name): 0
|
||||
error detected at relaxng.c:3944
|
||||
error detected at relaxng.c:3949
|
||||
xmlRelaxNGValidateDefinition(): validated card : -1
|
||||
|
@ -1,5 +1,5 @@
|
||||
Unimplemented block at xmlschemastypes.c:1132
|
||||
error detected at relaxng.c:3147
|
||||
error detected at relaxng.c:4120
|
||||
error detected at relaxng.c:3936
|
||||
error detected at relaxng.c:3151
|
||||
error detected at relaxng.c:4125
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated vector : -1
|
||||
|
@ -1,6 +1,6 @@
|
||||
Unimplemented block at xmlschemastypes.c:1132
|
||||
Unimplemented block at xmlschemastypes.c:1132
|
||||
error detected at relaxng.c:3335
|
||||
error detected at relaxng.c:4120
|
||||
error detected at relaxng.c:3936
|
||||
error detected at relaxng.c:3339
|
||||
error detected at relaxng.c:4125
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated vector : -1
|
||||
|
@ -1,3 +1,3 @@
|
||||
error detected at relaxng.c:3310
|
||||
error detected at relaxng.c:4120
|
||||
error detected at relaxng.c:3314
|
||||
error detected at relaxng.c:4125
|
||||
xmlRelaxNGValidateDefinition(): validated vector : -1
|
||||
|
1
result/relaxng/tutor8_2_1
Normal file
1
result/relaxng/tutor8_2_1
Normal file
@ -0,0 +1 @@
|
||||
./test/relaxng/tutor8_2_1.xml validates
|
7
result/relaxng/tutor8_2_1.err
Normal file
7
result/relaxng/tutor8_2_1.err
Normal file
@ -0,0 +1,7 @@
|
||||
xmlRelaxNGComputeInterleaves(interleave0)
|
||||
6 child
|
||||
6 groups
|
||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated head : 0
|
1
result/relaxng/tutor8_2_2
Normal file
1
result/relaxng/tutor8_2_2
Normal file
@ -0,0 +1 @@
|
||||
./test/relaxng/tutor8_2_2.xml validates
|
38
result/relaxng/tutor8_2_2.err
Normal file
38
result/relaxng/tutor8_2_2.err
Normal file
@ -0,0 +1,38 @@
|
||||
xmlRelaxNGComputeInterleaves(interleave0)
|
||||
6 child
|
||||
6 groups
|
||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||
xmlRelaxNGValidateDefinition(): validated base : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated style : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated script : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated link : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated meta : 0
|
||||
xmlRelaxNGValidateDefinition(): validated head : 0
|
1
result/relaxng/tutor8_2_3
Normal file
1
result/relaxng/tutor8_2_3
Normal file
@ -0,0 +1 @@
|
||||
./test/relaxng/tutor8_2_3.xml validates
|
5
result/relaxng/tutor8_2_3.err
Normal file
5
result/relaxng/tutor8_2_3.err
Normal file
@ -0,0 +1,5 @@
|
||||
xmlRelaxNGComputeInterleaves(interleave0)
|
||||
6 child
|
||||
6 groups
|
||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||
xmlRelaxNGValidateDefinition(): validated head : 0
|
2
result/relaxng/tutor8_2_4
Normal file
2
result/relaxng/tutor8_2_4
Normal file
@ -0,0 +1,2 @@
|
||||
Extra content for element head
|
||||
./test/relaxng/tutor8_2_4.xml validation generated an internal error
|
7
result/relaxng/tutor8_2_4.err
Normal file
7
result/relaxng/tutor8_2_4.err
Normal file
@ -0,0 +1,7 @@
|
||||
xmlRelaxNGComputeInterleaves(interleave0)
|
||||
6 child
|
||||
6 groups
|
||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated head : -1
|
3
result/relaxng/tutor8_2_5
Normal file
3
result/relaxng/tutor8_2_5
Normal file
@ -0,0 +1,3 @@
|
||||
Expecting an element
|
||||
Extra content for element head
|
||||
./test/relaxng/tutor8_2_5.xml validation generated an internal error
|
6
result/relaxng/tutor8_2_5.err
Normal file
6
result/relaxng/tutor8_2_5.err
Normal file
@ -0,0 +1,6 @@
|
||||
xmlRelaxNGComputeInterleaves(interleave0)
|
||||
6 child
|
||||
6 groups
|
||||
error detected at relaxng.c:3887
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated head : -1
|
2
result/relaxng/tutor8_2_6
Normal file
2
result/relaxng/tutor8_2_6
Normal file
@ -0,0 +1,2 @@
|
||||
Extra content for element head
|
||||
./test/relaxng/tutor8_2_6.xml validation generated an internal error
|
8
result/relaxng/tutor8_2_6.err
Normal file
8
result/relaxng/tutor8_2_6.err
Normal file
@ -0,0 +1,8 @@
|
||||
xmlRelaxNGComputeInterleaves(interleave0)
|
||||
6 child
|
||||
6 groups
|
||||
xmlRelaxNGValidateDefinition(): validated title : 0
|
||||
xmlRelaxNGValidateDefinition(): validated base : 0
|
||||
xmlRelaxNGValidateDefinition(): validated base : 0
|
||||
error detected at relaxng.c:3941
|
||||
xmlRelaxNGValidateDefinition(): validated head : -1
|
57
test/relaxng/tutor8_2.rng
Normal file
57
test/relaxng/tutor8_2.rng
Normal file
@ -0,0 +1,57 @@
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
<start>
|
||||
<ref name="head"/>
|
||||
</start>
|
||||
<define name="head">
|
||||
<element name="head">
|
||||
<interleave>
|
||||
<ref name="title"/>
|
||||
<optional>
|
||||
<ref name="base"/>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<ref name="style"/>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<ref name="script"/>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<ref name="link"/>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<ref name="meta"/>
|
||||
</zeroOrMore>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
<define name="title">
|
||||
<element name="title">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="base">
|
||||
<element name="base">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="style">
|
||||
<element name="style">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="script">
|
||||
<element name="script">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="meta">
|
||||
<element name="meta">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
<define name="link">
|
||||
<element name="link">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
</grammar>
|
5
test/relaxng/tutor8_2_1.xml
Normal file
5
test/relaxng/tutor8_2_1.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<head>
|
||||
<meta>meta1</meta>
|
||||
<title>foo</title>
|
||||
<meta>meta2</meta>
|
||||
</head>
|
36
test/relaxng/tutor8_2_2.xml
Normal file
36
test/relaxng/tutor8_2_2.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<head>
|
||||
<meta>meta</meta>
|
||||
<meta>meta</meta>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<base>base</base>
|
||||
<title>foo</title>
|
||||
<meta>meta</meta>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<meta>meta</meta>
|
||||
<meta>meta</meta>
|
||||
<meta>meta</meta>
|
||||
<meta>meta</meta>
|
||||
<meta>meta</meta>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
<script>script</script>
|
||||
<link>link</link>
|
||||
<style>link</style>
|
||||
</head>
|
3
test/relaxng/tutor8_2_3.xml
Normal file
3
test/relaxng/tutor8_2_3.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<head>
|
||||
<title>title</title>
|
||||
</head>
|
6
test/relaxng/tutor8_2_4.xml
Normal file
6
test/relaxng/tutor8_2_4.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<head>
|
||||
<meta>meta1</meta>
|
||||
<title>foo</title>
|
||||
<meta>meta2</meta>
|
||||
<title>error</title>
|
||||
</head>
|
3
test/relaxng/tutor8_2_5.xml
Normal file
3
test/relaxng/tutor8_2_5.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<head>
|
||||
<meta>meta2</meta>
|
||||
</head>
|
5
test/relaxng/tutor8_2_6.xml
Normal file
5
test/relaxng/tutor8_2_6.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<head>
|
||||
<base>base</base>
|
||||
<title>foo</title>
|
||||
<base>error</base>
|
||||
</head>
|
9
test/relaxng/tutor8_3.rng
Normal file
9
test/relaxng/tutor8_3.rng
Normal file
@ -0,0 +1,9 @@
|
||||
<element name="content" xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
<interleave>
|
||||
<text/>
|
||||
<element name="p">
|
||||
<text/>
|
||||
</element>
|
||||
</interleave>
|
||||
</element>
|
||||
|
1
test/relaxng/tutor8_3_1.xml
Normal file
1
test/relaxng/tutor8_3_1.xml
Normal file
@ -0,0 +1 @@
|
||||
<content> how are you <p> 'yau de poelle </p> ? </content>
|
Loading…
x
Reference in New Issue
Block a user