1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-29 21:46:59 +03:00

more Schemas work added more tests coming from the spec. Daniel

* xmlschemas.c: more Schemas work
* test/schemas/* result/schemas/*: added more tests coming
  from the spec.
Daniel
This commit is contained in:
Daniel Veillard 2002-04-19 07:01:55 +00:00
parent 547611303e
commit b439896915
16 changed files with 187 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Fri Apr 19 09:00:56 CEST 2002 Daniel Veillard <daniel@veillard.com>
* xmlschemas.c: more Schemas work
* test/schemas/* result/schemas/*: added more tests coming
from the spec.
Thu Apr 18 23:00:02 CEST 2002 Daniel Veillard <daniel@veillard.com>
* c14n.c: patch from Aleksey Sanin reflecting a change in the

View File

@ -0,0 +1 @@
./test/schemas/extension0_0.xml validates

View File

@ -0,0 +1,44 @@
Type of sequence 4 : ./test/schemas/extension0_0.xsd:13 :elements
Type of sequence 4 : ./test/schemas/extension0_0.xsd:13 :elements
Type of sequence 1 : ./test/schemas/extension0_0.xsd:4 :elements
Type of personName : ./test/schemas/extension0_0.xsd:3 :elements
Type of extension 3 : ./test/schemas/extension0_0.xsd:12 :elements
Type of extension 3 : ./test/schemas/extension0_0.xsd:12 :elements
Type of complexContent 2 : ./test/schemas/extension0_0.xsd:11 :elements
Type of complexContent 2 : ./test/schemas/extension0_0.xsd:11 :elements
Type of extendedName : ./test/schemas/extension0_0.xsd:10 :elements
Type of personName : ./test/schemas/extension0_0.xsd:3 :elements
Type of sequence 1 : ./test/schemas/extension0_0.xsd:4 :elements
Building content model for addressee
Content model of addressee:
regexp: '(null)'
4 atoms:
00 atom: string once 'title'
01 atom: string once 'forename'
02 atom: string once 'surname'
03 atom: string once 'generation'
5 states:
state: 0, 4 transitions:
trans: atom 0, to 1
trans: removed
trans: atom 1, to 2
trans: atom 2, to 3
state: 1, 3 transitions:
trans: atom 1, to 2
trans: removed
trans: atom 2, to 3
state: 2, 4 transitions:
trans: removed
trans: atom 2, to 3
trans: atom 1, to 2
trans: atom 2, to 3
state: FINAL 3, 2 transitions:
trans: atom 3, to 4
trans: removed
state: FINAL 4, 0 transitions:
0 counters:
xmlSchemaValidateCallback: forename, forename, forename
xmlSchemaValidateCallback: forename, forename, forename
xmlSchemaValidateCallback: surname, surname, surname
xmlSchemaValidateCallback: generation, generation, generation
Element addressee content check succeeded

View File

@ -0,0 +1 @@
./test/schemas/length2_0.xml validates

View File

@ -0,0 +1,24 @@
Unable to lookup type nonPositiveInteger:http://www.w3.org/2001/XMLSchemaSchemas: element size type nonPositiveInteger not found
Type of sequence 3 : ./test/schemas/length2_0.xsd:6 :elements
Type of sequence 3 : ./test/schemas/length2_0.xsd:6 :elements
Type of restriction 2 : ./test/schemas/length2_0.xsd:5 :elements
Type of complexContent 1 : ./test/schemas/length2_0.xsd:4 :elements
Type of length2 : ./test/schemas/length2_0.xsd:3 :elements
Type of complexContent 1 : ./test/schemas/length2_0.xsd:4 :elements
Type of restriction 2 : ./test/schemas/length2_0.xsd:5 :elements
Building content model for depth
Content model of depth:
regexp: '(null)'
2 atoms:
00 atom: string once 'size'
01 atom: string once 'unit'
3 states:
state: 0, 1 transitions:
trans: atom 0, to 1
state: 1, 1 transitions:
trans: atom 1, to 2
state: FINAL 2, 0 transitions:
0 counters:
xmlSchemaValidateCallback: size, size, size
xmlSchemaValidateCallback: unit, unit, unit
Element depth content check succeeded

View File

@ -0,0 +1 @@
./test/schemas/length3_0.xml validates

View File

@ -0,0 +1,20 @@
Unable to lookup type non-positive-integer:http://www.w3.org/2001/XMLSchemaSchemas: element size type non-positive-integer not found
Type of sequence 1 : ./test/schemas/length3_0.xsd:4 :elements
Type of length3 : ./test/schemas/length3_0.xsd:3 :elements
Type of sequence 1 : ./test/schemas/length3_0.xsd:4 :elements
Building content model for depth
Content model of depth:
regexp: '(null)'
2 atoms:
00 atom: string once 'size'
01 atom: string once 'unit'
3 states:
state: 0, 1 transitions:
trans: atom 0, to 1
state: 1, 1 transitions:
trans: atom 1, to 2
state: FINAL 2, 0 transitions:
0 counters:
xmlSchemaValidateCallback: size, size, size
xmlSchemaValidateCallback: unit, unit, unit
Element depth content check succeeded

View File

@ -0,0 +1 @@
./test/schemas/restriction0_0.xml validates

View File

@ -0,0 +1,26 @@
Type of sequence 4 : ./test/schemas/restriction0_0.xsd:13 :elements
Type of sequence 4 : ./test/schemas/restriction0_0.xsd:13 :elements
Type of restriction 3 : ./test/schemas/restriction0_0.xsd:12 :elements
Type of complexContent 2 : ./test/schemas/restriction0_0.xsd:11 :elements
Type of complexContent 2 : ./test/schemas/restriction0_0.xsd:11 :elements
Type of simpleName : ./test/schemas/restriction0_0.xsd:10 :elements
Type of sequence 1 : ./test/schemas/restriction0_0.xsd:4 :elements
Type of personName : ./test/schemas/restriction0_0.xsd:3 :elements
Type of sequence 1 : ./test/schemas/restriction0_0.xsd:4 :elements
Type of restriction 3 : ./test/schemas/restriction0_0.xsd:12 :elements
Building content model for who
Content model of who:
regexp: '(null)'
2 atoms:
00 atom: string once 'forename'
01 atom: string once 'surname'
3 states:
state: 0, 1 transitions:
trans: atom 0, to 1
state: 1, 1 transitions:
trans: atom 1, to 2
state: FINAL 2, 0 transitions:
0 counters:
xmlSchemaValidateCallback: forename, forename, forename
xmlSchemaValidateCallback: surname, surname, surname
Element who content check succeeded

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<depth>
<size>25</size>
<unit>cm</unit>
</depth>

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="length2">
<xs:complexContent>
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:element name="size" type="xs:nonPositiveInteger"/>
<xs:element name="unit" type="xs:NMTOKEN"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="depth" type="length2"/>
</xs:schema>

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<depth>
<size>25</size>
<unit>cm</unit>
</depth>

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="length3">
<xs:sequence>
<xs:element name="size" type="xs:non-positive-integer"/>
<xs:element name="unit" type="xs:NMTOKEN"/>
</xs:sequence>
</xs:complexType>
<xs:element name="depth" type="length3"/>
</xs:schema>

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<who>
<forename>Bill</forename>
<surname>Clinton</surname>
</who>

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="personName">
<xs:sequence>
<xs:element name="title" minOccurs="0"/>
<xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="surname"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="simpleName">
<xs:complexContent>
<xs:restriction base="personName">
<xs:sequence>
<xs:element name="forename" minOccurs="1" maxOccurs="1"/>
<xs:element name="surname"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="who" type="simpleName"/>
</xs:schema>

View File

@ -3041,9 +3041,7 @@ xmlSchemaBuildAContentModel(xmlSchemaTypePtr type,
break;
}
case XML_SCHEMA_TYPE_RESTRICTION:
if (type->baseType != NULL) {
TODO
} else if (type->subtypes != NULL)
if (type->subtypes != NULL)
xmlSchemaBuildAContentModel(type->subtypes, ctxt, name);
break;
case XML_SCHEMA_TYPE_EXTENSION:
@ -3685,6 +3683,8 @@ skip_children:
* Then do the parsing for good
*/
ret = xmlSchemaParseSchema(ctxt, root);
if (ret == NULL)
return(NULL);
ret->doc = doc;
/*