mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
fixing bug #104081 with xs:all with an element holding minOccurs="0" added
* xmlschemas.c: fixing bug #104081 with xs:all with an element holding minOccurs="0" * test/schemas/all_* result/schemas/all_*: added some regression tests for that bug * xmllint.c xmlreader.c: patches from Joerg Schmitz-Linneweber and Garry Pennington to compile without schemas support. Daniel
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
Fri May 9 15:34:32 EDT 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlschemas.c: fixing bug #104081 with xs:all with an element
|
||||||
|
holding minOccurs="0"
|
||||||
|
* test/schemas/all_* result/schemas/all_*: added some regression
|
||||||
|
tests for that bug
|
||||||
|
* xmllint.c xmlreader.c: patches from Joerg Schmitz-Linneweber and
|
||||||
|
Garry Pennington to compile without schemas support.
|
||||||
|
|
||||||
Thu May 1 10:02:35 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
Thu May 1 10:02:35 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* tree.c: fixed a problem with xmlUnlinkNode() for DTDs.
|
* tree.c: fixed a problem with xmlUnlinkNode() for DTDs.
|
||||||
|
1
result/schemas/all_0_6
Normal file
1
result/schemas/all_0_6
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_6.xml fails to validate
|
6
result/schemas/all_0_6.err
Normal file
6
result/schemas/all_0_6.err
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_0.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_0.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_0.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_0_7
Normal file
1
result/schemas/all_0_7
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_7.xml fails to validate
|
7
result/schemas/all_0_7.err
Normal file
7
result/schemas/all_0_7.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_0.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_0.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_0.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_1_6
Normal file
1
result/schemas/all_1_6
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_6.xml validates
|
6
result/schemas/all_1_6.err
Normal file
6
result/schemas/all_1_6.err
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_1.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_1.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_1.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
Element doc content check succeeded
|
1
result/schemas/all_1_7
Normal file
1
result/schemas/all_1_7
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_7.xml validates
|
7
result/schemas/all_1_7.err
Normal file
7
result/schemas/all_1_7.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_1.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_1.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_1.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check succeeded
|
1
result/schemas/all_2_0
Normal file
1
result/schemas/all_2_0
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_0.xml fails to validate
|
7
result/schemas/all_2_0.err
Normal file
7
result/schemas/all_2_0.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_2_1
Normal file
1
result/schemas/all_2_1
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_1.xml fails to validate
|
6
result/schemas/all_2_1.err
Normal file
6
result/schemas/all_2_1.err
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_2_2
Normal file
1
result/schemas/all_2_2
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_2.xml fails to validate
|
7
result/schemas/all_2_2.err
Normal file
7
result/schemas/all_2_2.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_2_3
Normal file
1
result/schemas/all_2_3
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_3.xml validates
|
7
result/schemas/all_2_3.err
Normal file
7
result/schemas/all_2_3.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check succeeded
|
1
result/schemas/all_2_4
Normal file
1
result/schemas/all_2_4
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_4.xml fails to validate
|
5
result/schemas/all_2_4.err
Normal file
5
result/schemas/all_2_4.err
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_2_5
Normal file
1
result/schemas/all_2_5
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_5.xml fails to validate
|
7
result/schemas/all_2_5.err
Normal file
7
result/schemas/all_2_5.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check failed
|
1
result/schemas/all_2_6
Normal file
1
result/schemas/all_2_6
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_6.xml validates
|
6
result/schemas/all_2_6.err
Normal file
6
result/schemas/all_2_6.err
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
Element doc content check succeeded
|
1
result/schemas/all_2_7
Normal file
1
result/schemas/all_2_7
Normal file
@ -0,0 +1 @@
|
|||||||
|
./test/schemas/all_7.xml validates
|
7
result/schemas/all_2_7.err
Normal file
7
result/schemas/all_2_7.err
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Type of anontype1 : ./test/schemas/all_2.xsd:4 :elements
|
||||||
|
Type of all2 : ./test/schemas/all_2.xsd:5 :elements
|
||||||
|
Building content model for doc
|
||||||
|
xmlSchemaValidateCallback: a, a, a
|
||||||
|
xmlSchemaValidateCallback: b, b, b
|
||||||
|
Element doc content check succeeded
|
11
test/schemas/all_2.xsd
Normal file
11
test/schemas/all_2.xsd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xsd:element name="doc">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:all>
|
||||||
|
<xsd:element name="a"/>
|
||||||
|
<xsd:element minOccurs="0" name="b"/>
|
||||||
|
</xsd:all>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
1
test/schemas/all_6.xml
Normal file
1
test/schemas/all_6.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<doc><a/></doc>
|
1
test/schemas/all_7.xml
Normal file
1
test/schemas/all_7.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<doc><a/><b/></doc>
|
@ -626,6 +626,7 @@ static void streamFile(char *filename) {
|
|||||||
xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1);
|
xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1);
|
||||||
else
|
else
|
||||||
xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1);
|
xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1);
|
||||||
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
if (relaxng != NULL) {
|
if (relaxng != NULL) {
|
||||||
if (timing) {
|
if (timing) {
|
||||||
startTimer();
|
startTimer();
|
||||||
@ -640,6 +641,7 @@ static void streamFile(char *filename) {
|
|||||||
endTimer("Compiling the schemas");
|
endTimer("Compiling the schemas");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process all nodes in sequence
|
* Process all nodes in sequence
|
||||||
@ -654,7 +656,11 @@ static void streamFile(char *filename) {
|
|||||||
ret = xmlTextReaderRead(reader);
|
ret = xmlTextReaderRead(reader);
|
||||||
}
|
}
|
||||||
if (timing) {
|
if (timing) {
|
||||||
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
if ((valid) || (relaxng != NULL))
|
if ((valid) || (relaxng != NULL))
|
||||||
|
#else
|
||||||
|
if (valid)
|
||||||
|
#endif
|
||||||
endTimer("Parsing and validating");
|
endTimer("Parsing and validating");
|
||||||
else
|
else
|
||||||
endTimer("Parsing");
|
endTimer("Parsing");
|
||||||
@ -667,6 +673,7 @@ static void streamFile(char *filename) {
|
|||||||
progresult = 3;
|
progresult = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
if (relaxng != NULL) {
|
if (relaxng != NULL) {
|
||||||
if (xmlTextReaderIsValid(reader) != 1) {
|
if (xmlTextReaderIsValid(reader) != 1) {
|
||||||
printf("%s fails to validate\n", filename);
|
printf("%s fails to validate\n", filename);
|
||||||
@ -675,6 +682,7 @@ static void streamFile(char *filename) {
|
|||||||
printf("%s validates\n", filename);
|
printf("%s validates\n", filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Done, cleanup and status
|
* Done, cleanup and status
|
||||||
*/
|
*/
|
||||||
|
@ -1208,6 +1208,7 @@ void
|
|||||||
xmlFreeTextReader(xmlTextReaderPtr reader) {
|
xmlFreeTextReader(xmlTextReaderPtr reader) {
|
||||||
if (reader == NULL)
|
if (reader == NULL)
|
||||||
return;
|
return;
|
||||||
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
if (reader->rngSchemas != NULL) {
|
if (reader->rngSchemas != NULL) {
|
||||||
xmlRelaxNGFree(reader->rngSchemas);
|
xmlRelaxNGFree(reader->rngSchemas);
|
||||||
reader->rngSchemas = NULL;
|
reader->rngSchemas = NULL;
|
||||||
@ -1216,6 +1217,7 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
|
|||||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||||
reader->rngValidCtxt = NULL;
|
reader->rngValidCtxt = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (reader->ctxt != NULL) {
|
if (reader->ctxt != NULL) {
|
||||||
if (reader->ctxt->myDoc != NULL) {
|
if (reader->ctxt->myDoc != NULL) {
|
||||||
xmlFreeDoc(reader->ctxt->myDoc);
|
xmlFreeDoc(reader->ctxt->myDoc);
|
||||||
@ -2473,6 +2475,7 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
|
|||||||
return(reader->ctxt->myDoc);
|
return(reader->ctxt->myDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
/**
|
/**
|
||||||
* xmlTextReaderRelaxNGSetSchema:
|
* xmlTextReaderRelaxNGSetSchema:
|
||||||
* @reader: the xmlTextReaderPtr used
|
* @reader: the xmlTextReaderPtr used
|
||||||
@ -2590,6 +2593,7 @@ xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) {
|
|||||||
reader->validate = XML_TEXTREADER_VALIDATE_RNG;
|
reader->validate = XML_TEXTREADER_VALIDATE_RNG;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
|
11
xmlschemas.c
11
xmlschemas.c
@ -3350,9 +3350,14 @@ xmlSchemaBuildAContentModel(xmlSchemaTypePtr type,
|
|||||||
elem = (xmlSchemaElementPtr) subtypes;
|
elem = (xmlSchemaElementPtr) subtypes;
|
||||||
|
|
||||||
/* TODO : handle the namespace too */
|
/* TODO : handle the namespace too */
|
||||||
xmlAutomataNewOnceTrans(ctxt->am, ctxt->state, ctxt->state,
|
if ((elem->minOccurs == 1) && (elem->maxOccurs == 1)) {
|
||||||
elem->name, elem->minOccurs, elem->maxOccurs,
|
xmlAutomataNewOnceTrans(ctxt->am, ctxt->state, ctxt->state,
|
||||||
subtypes);
|
elem->name, 1, 1, subtypes);
|
||||||
|
} else {
|
||||||
|
xmlAutomataNewCountTrans(ctxt->am, ctxt->state, ctxt->state,
|
||||||
|
elem->name, elem->minOccurs,
|
||||||
|
elem->maxOccurs, subtypes);
|
||||||
|
}
|
||||||
subtypes = subtypes->next;
|
subtypes = subtypes->next;
|
||||||
}
|
}
|
||||||
lax = type->minOccurs == 0;
|
lax = type->minOccurs == 0;
|
||||||
|
Reference in New Issue
Block a user