mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +03:00
a bit of work on Schemas try to make it more useful changed the Schemas
* xmlschemas.c xmlschemastypes.c include/libxml/xmlschemas.h: a bit of work on Schemas * testSchemas.c: try to make it more useful * test/schemas/* result/schemas/* Makefile.am: changed the Schemas regression test procedure, started adding a few samples Daniel
This commit is contained in:
parent
e1eff38389
commit
8651f5365c
@ -1,3 +1,11 @@
|
||||
Wed Apr 17 11:03:03 CEST 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlschemas.c xmlschemastypes.c include/libxml/xmlschemas.h:
|
||||
a bit of work on Schemas
|
||||
* testSchemas.c: try to make it more useful
|
||||
* test/schemas/* result/schemas/* Makefile.am: changed the
|
||||
Schemas regression test procedure, started adding a few samples
|
||||
|
||||
Tue Apr 16 19:52:01 CEST 2002 Igor Zlatkovic <izlatkovic@stud.fh-frankfurt.de>
|
||||
|
||||
* include/libxml/encoding.h: Patch for the Borland C++ builder
|
||||
|
41
Makefile.am
41
Makefile.am
@ -617,22 +617,29 @@ Schemastests: testSchemas$(EXEEXT)
|
||||
@echo "##"
|
||||
@echo "## Schemas regression tests"
|
||||
@echo "##"
|
||||
-@(for i in $(srcdir)/test/schemas/*.xml ; do \
|
||||
name=`basename $$i .xml`; \
|
||||
if [ ! -f $(srcdir)/test/schemas/$$name.xsd ] ; then continue ; fi ; \
|
||||
schemas="$(srcdir)/test/schemas/$$name.xsd" ; \
|
||||
if [ ! -d $$i ] ; then \
|
||||
if [ ! -f $(srcdir)/result/schemas/$$name ] ; then \
|
||||
echo New test file $$name ; \
|
||||
$(CHECKER) $(top_builddir)/testSchemas $$schemas $$i > $(srcdir)/result/schemas/$$name; \
|
||||
else \
|
||||
echo Testing $$name ; \
|
||||
$(CHECKER) $(top_builddir)/testSchemas $$schemas $$i > result.$$name ; \
|
||||
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
||||
diff $(srcdir)/result/schemas/$$name result.$$name ; \
|
||||
rm result.$$name ; \
|
||||
fi ; fi ; done)
|
||||
|
||||
-@(for i in $(srcdir)/test/schemas/*_*.xsd ; do \
|
||||
name=`basename $$i | sed 's+_.*++'`; \
|
||||
sno=`basename $$i | sed 's+.*_\(.*\).xsd+\1+'`; \
|
||||
for j in $(srcdir)/test/schemas/"$$name"_*.xml ; do \
|
||||
xno=`basename $$j | sed 's+.*_\(.*\).xml+\1+'`; \
|
||||
if [ ! -f $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" ]; \
|
||||
then \
|
||||
echo New test file "$$name"_"$$xno" ; \
|
||||
$(CHECKER) $(top_builddir)/testSchemas $$i $$j \
|
||||
> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
|
||||
2> $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err; \
|
||||
else \
|
||||
echo Testing "$$name"_"$$xno" ; \
|
||||
$(CHECKER) $(top_builddir)/testSchemas $$i $$j \
|
||||
> res.$$name 2> err.$$name;\
|
||||
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
|
||||
diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno" \
|
||||
res.$$name;\
|
||||
diff $(srcdir)/result/schemas/"$$name"_"$$sno"_"$$xno".err \
|
||||
err.$$name;\
|
||||
rm res.$$name err.$$name ; \
|
||||
fi ; \
|
||||
done; done)
|
||||
|
||||
dist-hook: libxml.spec
|
||||
-cp libxml.spec $(distdir)
|
||||
@ -659,7 +666,7 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml.spec \
|
||||
$(man_MANS) libxml-2.0.pc.in \
|
||||
trionan.c trionan.h triostr.c triostr.h trio.c trio.h \
|
||||
triop.h triodef.h libxml.h \
|
||||
testThreadsWin32.c genUnicode.py
|
||||
testThreadsWin32.c genUnicode.py TODO_SCHEMAS
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libxml-2.0.pc
|
||||
|
@ -35,6 +35,7 @@ typedef enum {
|
||||
XML_SCHEMAS_ERR_NOROLLBACK,
|
||||
XML_SCHEMAS_ERR_ISABSTRACT,
|
||||
XML_SCHEMAS_ERR_NOTEMPTY,
|
||||
XML_SCHEMAS_ERR_ELEMCONT,
|
||||
XML_SCHEMAS_ERR_HAVEDEFAULT,
|
||||
XML_SCHEMAS_ERR_NOTNILLABLE,
|
||||
XML_SCHEMAS_ERR_EXTRACONTENT,
|
||||
|
1
result/schemas/choice_0_0
Normal file
1
result/schemas/choice_0_0
Normal file
@ -0,0 +1 @@
|
||||
./test/schemas/choice_0.xml validates
|
24
result/schemas/choice_0_0.err
Normal file
24
result/schemas/choice_0_0.err
Normal file
@ -0,0 +1,24 @@
|
||||
Type of choice 3 : ./test/schemas/choice_0.xsd:6 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Type of anontype1 : ./test/schemas/choice_0.xsd:4 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Building content model for doc
|
||||
Content model of doc:
|
||||
regexp: '(null)'
|
||||
2 atoms:
|
||||
00 atom: string once 'a'
|
||||
01 atom: string once 'b'
|
||||
4 states:
|
||||
state: 0, 2 transitions:
|
||||
trans: atom 0, to 2
|
||||
trans: atom 1, to 3
|
||||
state: FINAL 1, 0 transitions:
|
||||
state: FINAL 2, 1 transitions:
|
||||
trans: removed
|
||||
state: FINAL 3, 1 transitions:
|
||||
trans: removed
|
||||
0 counters:
|
||||
Building content model for a
|
||||
Building content model for b
|
||||
xmlSchemaValidateCallback: a, a, a
|
||||
Element doc content check succeeded
|
1
result/schemas/choice_0_1
Normal file
1
result/schemas/choice_0_1
Normal file
@ -0,0 +1 @@
|
||||
./test/schemas/choice_1.xml validates
|
24
result/schemas/choice_0_1.err
Normal file
24
result/schemas/choice_0_1.err
Normal file
@ -0,0 +1,24 @@
|
||||
Type of choice 3 : ./test/schemas/choice_0.xsd:6 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Type of anontype1 : ./test/schemas/choice_0.xsd:4 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Building content model for doc
|
||||
Content model of doc:
|
||||
regexp: '(null)'
|
||||
2 atoms:
|
||||
00 atom: string once 'a'
|
||||
01 atom: string once 'b'
|
||||
4 states:
|
||||
state: 0, 2 transitions:
|
||||
trans: atom 0, to 2
|
||||
trans: atom 1, to 3
|
||||
state: FINAL 1, 0 transitions:
|
||||
state: FINAL 2, 1 transitions:
|
||||
trans: removed
|
||||
state: FINAL 3, 1 transitions:
|
||||
trans: removed
|
||||
0 counters:
|
||||
Building content model for a
|
||||
Building content model for b
|
||||
xmlSchemaValidateCallback: b, b, b
|
||||
Element doc content check succeeded
|
1
result/schemas/choice_0_2
Normal file
1
result/schemas/choice_0_2
Normal file
@ -0,0 +1 @@
|
||||
./test/schemas/choice_2.xml fails to validate
|
24
result/schemas/choice_0_2.err
Normal file
24
result/schemas/choice_0_2.err
Normal file
@ -0,0 +1,24 @@
|
||||
Type of choice 3 : ./test/schemas/choice_0.xsd:6 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Type of anontype1 : ./test/schemas/choice_0.xsd:4 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Building content model for doc
|
||||
Content model of doc:
|
||||
regexp: '(null)'
|
||||
2 atoms:
|
||||
00 atom: string once 'a'
|
||||
01 atom: string once 'b'
|
||||
4 states:
|
||||
state: 0, 2 transitions:
|
||||
trans: atom 0, to 2
|
||||
trans: atom 1, to 3
|
||||
state: FINAL 1, 0 transitions:
|
||||
state: FINAL 2, 1 transitions:
|
||||
trans: removed
|
||||
state: FINAL 3, 1 transitions:
|
||||
trans: removed
|
||||
0 counters:
|
||||
Building content model for a
|
||||
Building content model for b
|
||||
xmlSchemaValidateCallback: a, a, a
|
||||
Element doc content check failed
|
1
result/schemas/choice_0_3
Normal file
1
result/schemas/choice_0_3
Normal file
@ -0,0 +1 @@
|
||||
./test/schemas/choice_3.xml fails to validate
|
24
result/schemas/choice_0_3.err
Normal file
24
result/schemas/choice_0_3.err
Normal file
@ -0,0 +1,24 @@
|
||||
Type of choice 3 : ./test/schemas/choice_0.xsd:6 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Type of anontype1 : ./test/schemas/choice_0.xsd:4 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Building content model for doc
|
||||
Content model of doc:
|
||||
regexp: '(null)'
|
||||
2 atoms:
|
||||
00 atom: string once 'a'
|
||||
01 atom: string once 'b'
|
||||
4 states:
|
||||
state: 0, 2 transitions:
|
||||
trans: atom 0, to 2
|
||||
trans: atom 1, to 3
|
||||
state: FINAL 1, 0 transitions:
|
||||
state: FINAL 2, 1 transitions:
|
||||
trans: removed
|
||||
state: FINAL 3, 1 transitions:
|
||||
trans: removed
|
||||
0 counters:
|
||||
Building content model for a
|
||||
Building content model for b
|
||||
xmlSchemaValidateCallback: a, a, a
|
||||
Element doc content check failed
|
1
result/schemas/choice_0_4
Normal file
1
result/schemas/choice_0_4
Normal file
@ -0,0 +1 @@
|
||||
./test/schemas/choice_4.xml fails to validate
|
23
result/schemas/choice_0_4.err
Normal file
23
result/schemas/choice_0_4.err
Normal file
@ -0,0 +1,23 @@
|
||||
Type of choice 3 : ./test/schemas/choice_0.xsd:6 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Type of anontype1 : ./test/schemas/choice_0.xsd:4 :elements
|
||||
Type of sequence 2 : ./test/schemas/choice_0.xsd:5 :elements
|
||||
Building content model for doc
|
||||
Content model of doc:
|
||||
regexp: '(null)'
|
||||
2 atoms:
|
||||
00 atom: string once 'a'
|
||||
01 atom: string once 'b'
|
||||
4 states:
|
||||
state: 0, 2 transitions:
|
||||
trans: atom 0, to 2
|
||||
trans: atom 1, to 3
|
||||
state: FINAL 1, 0 transitions:
|
||||
state: FINAL 2, 1 transitions:
|
||||
trans: removed
|
||||
state: FINAL 3, 1 transitions:
|
||||
trans: removed
|
||||
0 counters:
|
||||
Building content model for a
|
||||
Building content model for b
|
||||
Element doc content check failed
|
1
result/schemas/po0_0_0
Normal file
1
result/schemas/po0_0_0
Normal file
@ -0,0 +1 @@
|
||||
./test/schemas/po0_0.xml validates
|
161
result/schemas/po0_0_0.err
Normal file
161
result/schemas/po0_0_0.err
Normal file
@ -0,0 +1,161 @@
|
||||
Type of sequence 3 : ./test/schemas/po0_0.xsd:21 :elements
|
||||
Type of sequence 4 : ./test/schemas/po0_0.xsd:31 :elements
|
||||
Type of sequence 6 : ./test/schemas/po0_0.xsd:34 :elements
|
||||
Type of anontype5 : ./test/schemas/po0_0.xsd:33 :elements
|
||||
Type of sequence 1 : ./test/schemas/po0_0.xsd:12 :elements
|
||||
Type of PurchaseOrderType : ./test/schemas/po0_0.xsd:11 :elements
|
||||
Type of sequence 6 : ./test/schemas/po0_0.xsd:34 :elements
|
||||
Type of SKU : ./test/schemas/po0_0.xsd:53 :simple
|
||||
Type of sequence 4 : ./test/schemas/po0_0.xsd:31 :elements
|
||||
Type of Items : ./test/schemas/po0_0.xsd:30 :elements
|
||||
Type of restriction 8 : ./test/schemas/po0_0.xsd:38 :empty
|
||||
Type of simpletype7 : ./test/schemas/po0_0.xsd:37 :simple
|
||||
Type of restriction 10 : ./test/schemas/po0_0.xsd:54 :empty
|
||||
Type of sequence 1 : ./test/schemas/po0_0.xsd:12 :elements
|
||||
Type of sequence 3 : ./test/schemas/po0_0.xsd:21 :elements
|
||||
Type of USAddress : ./test/schemas/po0_0.xsd:20 :elements
|
||||
Building content model for anonelem2
|
||||
Building content model for street
|
||||
Building content model for state
|
||||
Building content model for shipTo
|
||||
Content model of shipTo:
|
||||
regexp: '(null)'
|
||||
5 atoms:
|
||||
00 atom: string once 'name'
|
||||
01 atom: string once 'street'
|
||||
02 atom: string once 'city'
|
||||
03 atom: string once 'state'
|
||||
04 atom: string once 'zip'
|
||||
6 states:
|
||||
state: 0, 1 transitions:
|
||||
trans: atom 0, to 1
|
||||
state: 1, 1 transitions:
|
||||
trans: atom 1, to 2
|
||||
state: 2, 1 transitions:
|
||||
trans: atom 2, to 3
|
||||
state: 3, 1 transitions:
|
||||
trans: atom 3, to 4
|
||||
state: 4, 1 transitions:
|
||||
trans: atom 4, to 5
|
||||
state: FINAL 5, 0 transitions:
|
||||
0 counters:
|
||||
Building content model for comment
|
||||
Building content model for name
|
||||
Building content model for item
|
||||
Content model of item:
|
||||
regexp: '(null)'
|
||||
5 atoms:
|
||||
00 atom: string once 'productName'
|
||||
01 atom: string once 'quantity'
|
||||
02 atom: string once 'USPrice'
|
||||
03 atom: string once 'comment'
|
||||
04 atom: string once 'shipDate'
|
||||
6 states:
|
||||
state: 0, 1 transitions:
|
||||
trans: atom 0, to 1
|
||||
state: 1, 1 transitions:
|
||||
trans: atom 1, to 2
|
||||
state: 2, 1 transitions:
|
||||
trans: atom 2, to 3
|
||||
state: FINAL 3, 3 transitions:
|
||||
trans: atom 3, to 4
|
||||
trans: removed
|
||||
trans: atom 4, to 5
|
||||
state: FINAL 4, 2 transitions:
|
||||
trans: atom 4, to 5
|
||||
trans: removed
|
||||
state: FINAL 5, 0 transitions:
|
||||
0 counters:
|
||||
Building content model for productName
|
||||
Building content model for anonelem9
|
||||
Building content model for quantity
|
||||
Building content model for purchaseOrder
|
||||
Content model of purchaseOrder:
|
||||
regexp: '(null)'
|
||||
4 atoms:
|
||||
00 atom: string once 'shipTo'
|
||||
01 atom: string once 'billTo'
|
||||
02 atom: string once 'comment'
|
||||
03 atom: string once 'items'
|
||||
5 states:
|
||||
state: 0, 1 transitions:
|
||||
trans: atom 0, to 1
|
||||
state: 1, 1 transitions:
|
||||
trans: atom 1, to 2
|
||||
state: 2, 3 transitions:
|
||||
trans: atom 2, to 3
|
||||
trans: removed
|
||||
trans: atom 3, to 4
|
||||
state: 3, 1 transitions:
|
||||
trans: atom 3, to 4
|
||||
state: FINAL 4, 0 transitions:
|
||||
0 counters:
|
||||
Building content model for billTo
|
||||
Content model of billTo:
|
||||
regexp: '(null)'
|
||||
5 atoms:
|
||||
00 atom: string once 'name'
|
||||
01 atom: string once 'street'
|
||||
02 atom: string once 'city'
|
||||
03 atom: string once 'state'
|
||||
04 atom: string once 'zip'
|
||||
6 states:
|
||||
state: 0, 1 transitions:
|
||||
trans: atom 0, to 1
|
||||
state: 1, 1 transitions:
|
||||
trans: atom 1, to 2
|
||||
state: 2, 1 transitions:
|
||||
trans: atom 2, to 3
|
||||
state: 3, 1 transitions:
|
||||
trans: atom 3, to 4
|
||||
state: 4, 1 transitions:
|
||||
trans: atom 4, to 5
|
||||
state: FINAL 5, 0 transitions:
|
||||
0 counters:
|
||||
Building content model for zip
|
||||
Building content model for USPrice
|
||||
Building content model for items
|
||||
Content model of items:
|
||||
regexp: '(null)'
|
||||
1 atoms:
|
||||
00 atom: string once 'item'
|
||||
2 states:
|
||||
state: FINAL 0, 2 transitions:
|
||||
trans: atom 0, to 1
|
||||
trans: removed
|
||||
state: FINAL 1, 2 transitions:
|
||||
trans: removed
|
||||
trans: atom 0, to 1
|
||||
0 counters:
|
||||
Building content model for city
|
||||
Building content model for shipDate
|
||||
xmlSchemaValidateCallback: shipTo, shipTo, shipTo
|
||||
xmlSchemaValidateCallback: name, name, name
|
||||
xmlSchemaValidateCallback: street, street, street
|
||||
xmlSchemaValidateCallback: city, city, city
|
||||
xmlSchemaValidateCallback: state, state, state
|
||||
xmlSchemaValidateCallback: zip, zip, zip
|
||||
Element shipTo content check succeeded
|
||||
xmlSchemaValidateCallback: billTo, billTo, billTo
|
||||
xmlSchemaValidateCallback: name, name, name
|
||||
xmlSchemaValidateCallback: street, street, street
|
||||
xmlSchemaValidateCallback: city, city, city
|
||||
xmlSchemaValidateCallback: state, state, state
|
||||
xmlSchemaValidateCallback: zip, zip, zip
|
||||
Element billTo content check succeeded
|
||||
xmlSchemaValidateCallback: comment, comment, comment
|
||||
xmlSchemaValidateCallback: items, items, items
|
||||
xmlSchemaValidateCallback: item, item, item
|
||||
xmlSchemaValidateCallback: productName, productName, productName
|
||||
xmlSchemaValidateCallback: quantity, quantity, quantity
|
||||
xmlSchemaValidateCallback: USPrice, USPrice, USPrice
|
||||
xmlSchemaValidateCallback: comment, comment, comment
|
||||
Element item content check succeeded
|
||||
xmlSchemaValidateCallback: item, item, item
|
||||
xmlSchemaValidateCallback: productName, productName, productName
|
||||
xmlSchemaValidateCallback: quantity, quantity, quantity
|
||||
xmlSchemaValidateCallback: USPrice, USPrice, USPrice
|
||||
xmlSchemaValidateCallback: shipDate, shipDate, shipDate
|
||||
Element item content check succeeded
|
||||
Element items content check succeeded
|
||||
Element purchaseOrder content check succeeded
|
3
test/schemas/choice_0.xml
Normal file
3
test/schemas/choice_0.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<doc>
|
||||
<a/>
|
||||
</doc>
|
13
test/schemas/choice_0.xsd
Normal file
13
test/schemas/choice_0.xsd
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="doc">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element name="a"/>
|
||||
<xs:element name="b"/>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
3
test/schemas/choice_1.xml
Normal file
3
test/schemas/choice_1.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<doc>
|
||||
<b/>
|
||||
</doc>
|
4
test/schemas/choice_2.xml
Normal file
4
test/schemas/choice_2.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<doc>
|
||||
<a/>
|
||||
<b/>
|
||||
</doc>
|
4
test/schemas/choice_3.xml
Normal file
4
test/schemas/choice_3.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<doc>
|
||||
<a/>
|
||||
<a/>
|
||||
</doc>
|
2
test/schemas/choice_4.xml
Normal file
2
test/schemas/choice_4.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<doc>
|
||||
</doc>
|
@ -88,6 +88,14 @@ int main(int argc, char **argv) {
|
||||
(xmlSchemaValidityWarningFunc) fprintf,
|
||||
stderr);
|
||||
ret = xmlSchemaValidateDoc(ctxt, doc);
|
||||
if (ret == 0) {
|
||||
printf("%s validates\n", argv[i]);
|
||||
} else if (ret > 0) {
|
||||
printf("%s fails to validate\n", argv[i]);
|
||||
} else {
|
||||
printf("%s validation generated an internal error\n",
|
||||
argv[i]);
|
||||
}
|
||||
xmlSchemaFreeValidCtxt(ctxt);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
54
xmlschemas.c
54
xmlschemas.c
@ -24,8 +24,9 @@
|
||||
#include <libxml/xmlautomata.h>
|
||||
#include <libxml/xmlregexp.h>
|
||||
|
||||
#define DEBUG 1 /* very verobose output */
|
||||
/* #define DEBUG_CONTENT 1 */
|
||||
#define DEBUG 1 /* very verbose output */
|
||||
#define DEBUG_CONTENT 1
|
||||
#define DEBUG_TYPE 1
|
||||
/* #define DEBUG_AUTOMATA 1 */
|
||||
|
||||
#define UNBOUNDED (1 << 30)
|
||||
@ -3058,8 +3059,9 @@ xmlSchemaBuildContentModel(xmlSchemaElementPtr elem,
|
||||
xmlAutomataSetFinalState(ctxt->am, ctxt->state);
|
||||
elem->contModel = xmlAutomataCompile(ctxt->am);
|
||||
#ifdef DEBUG_CONTENT
|
||||
printf("Content model of %s:\n", name);
|
||||
xmlRegexpPrint(stdout, elem->contModel);
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Content model of %s:\n", name);
|
||||
xmlRegexpPrint(stderr, elem->contModel);
|
||||
#endif
|
||||
ctxt->state = NULL;
|
||||
xmlFreeAutomata(ctxt->am);
|
||||
@ -3205,6 +3207,7 @@ xmlSchemaTypeFixup(xmlSchemaTypePtr typeDecl,
|
||||
if (typeDecl->subtypes != NULL)
|
||||
xmlSchemaTypeFixup(typeDecl->subtypes, ctxt, NULL);
|
||||
|
||||
explicitContentType = XML_SCHEMA_CONTENT_ELEMENTS;
|
||||
if (typeDecl->subtypes == NULL)
|
||||
/* 1.1.1 */
|
||||
explicitContentType = XML_SCHEMA_CONTENT_EMPTY;
|
||||
@ -3299,6 +3302,37 @@ xmlSchemaTypeFixup(xmlSchemaTypePtr typeDecl,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_TYPE
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Type of %s : %s:%d :", name, typeDecl->node->doc->URL,
|
||||
xmlGetLineNo(typeDecl->node));
|
||||
switch (typeDecl->contentType) {
|
||||
case XML_SCHEMA_CONTENT_SIMPLE:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"simple\n"); break;
|
||||
case XML_SCHEMA_CONTENT_ELEMENTS:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"elements\n"); break;
|
||||
case XML_SCHEMA_CONTENT_UNKNOWN:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"unknown !!!\n"); break;
|
||||
case XML_SCHEMA_CONTENT_EMPTY:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"empty\n"); break;
|
||||
case XML_SCHEMA_CONTENT_MIXED:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"mixed\n"); break;
|
||||
case XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"mixed or elems\n"); break;
|
||||
case XML_SCHEMA_CONTENT_BASIC:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"basic\n"); break;
|
||||
default:
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"not registered !!!\n"); break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3970,8 +4004,9 @@ xmlSchemaValidateCallback(xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSchemaTypePtr oldtype = ctxt->type;
|
||||
xmlNodePtr oldnode = ctxt->node;
|
||||
#ifdef DEBUG_CONTENT
|
||||
printf("xmlSchemaValidateCallback: %s, %s, %s\n",
|
||||
name, type->name, node->name);
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlSchemaValidateCallback: %s, %s, %s\n",
|
||||
name, type->name, node->name);
|
||||
#endif
|
||||
ctxt->type = type;
|
||||
ctxt->node = node;
|
||||
@ -4195,10 +4230,12 @@ xmlSchemaValidateElementType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
|
||||
"====> %s : %d\n", node->name, ret);
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData, "Element %s content check failed\n",
|
||||
node->name);
|
||||
} else if (ret < 0) {
|
||||
ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData, "Element %s content check failure\n",
|
||||
node->name);
|
||||
@ -4335,7 +4372,7 @@ xmlSchemaValidateBasicType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
|
||||
static int
|
||||
xmlSchemaValidateComplexType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
|
||||
xmlNodePtr child;
|
||||
xmlSchemaTypePtr type, subtype, model;
|
||||
xmlSchemaTypePtr type, subtype;
|
||||
int ret;
|
||||
|
||||
child = ctxt->node;
|
||||
@ -4360,7 +4397,6 @@ xmlSchemaValidateComplexType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr node) {
|
||||
*/
|
||||
child = xmlSchemaSkipIgnored(ctxt, type, child);
|
||||
subtype = type->subtypes;
|
||||
ctxt->type = model;
|
||||
while (child != NULL) {
|
||||
if (child->type == XML_ELEMENT_NODE) {
|
||||
ret = xmlRegExecPushString(ctxt->regexp,
|
||||
@ -4735,10 +4771,12 @@ xmlSchemaValidateElement(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem) {
|
||||
"====> %s : %d\n", elem->name, ret);
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData, "Element %s content check failed\n",
|
||||
elem->name);
|
||||
} else if (ret < 0) {
|
||||
ctxt->err = XML_SCHEMAS_ERR_ELEMCONT;
|
||||
if (ctxt->error != NULL)
|
||||
ctxt->error(ctxt->userData, "Element %s content check failed\n",
|
||||
elem->name);
|
||||
|
@ -481,6 +481,9 @@ xmlSchemaValidateFacet(xmlSchemaTypePtr base, xmlSchemaFacetPtr facet,
|
||||
return(0);
|
||||
TODO /* error code */
|
||||
return(1);
|
||||
case XML_SCHEMA_FACET_WHITESPACE:
|
||||
TODO /* whitespaces */
|
||||
return(0);
|
||||
default:
|
||||
TODO
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user