diff options
27 files changed, 405 insertions, 25 deletions
@@ -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 diff --git a/Makefile.am b/Makefile.am index 3d90f4d2..add1dcd1 100644 --- a/Makefile.am +++ b/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 diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h index 58bf645a..c0ca7339 100644 --- a/include/libxml/xmlschemas.h +++ b/include/libxml/xmlschemas.h @@ -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, diff --git a/result/schemas/choice_0_0 b/result/schemas/choice_0_0 new file mode 100644 index 00000000..eda062ec --- /dev/null +++ b/result/schemas/choice_0_0 @@ -0,0 +1 @@ +./test/schemas/choice_0.xml validates diff --git a/result/schemas/choice_0_0.err b/result/schemas/choice_0_0.err new file mode 100644 index 00000000..f655977b --- /dev/null +++ b/result/schemas/choice_0_0.err @@ -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 diff --git a/result/schemas/choice_0_1 b/result/schemas/choice_0_1 new file mode 100644 index 00000000..e4338ded --- /dev/null +++ b/result/schemas/choice_0_1 @@ -0,0 +1 @@ +./test/schemas/choice_1.xml validates diff --git a/result/schemas/choice_0_1.err b/result/schemas/choice_0_1.err new file mode 100644 index 00000000..63681abd --- /dev/null +++ b/result/schemas/choice_0_1.err @@ -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 diff --git a/result/schemas/choice_0_2 b/result/schemas/choice_0_2 new file mode 100644 index 00000000..40713158 --- /dev/null +++ b/result/schemas/choice_0_2 @@ -0,0 +1 @@ +./test/schemas/choice_2.xml fails to validate diff --git a/result/schemas/choice_0_2.err b/result/schemas/choice_0_2.err new file mode 100644 index 00000000..a4025c9d --- /dev/null +++ b/result/schemas/choice_0_2.err @@ -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 diff --git a/result/schemas/choice_0_3 b/result/schemas/choice_0_3 new file mode 100644 index 00000000..bef604b9 --- /dev/null +++ b/result/schemas/choice_0_3 @@ -0,0 +1 @@ +./test/schemas/choice_3.xml fails to validate diff --git a/result/schemas/choice_0_3.err b/result/schemas/choice_0_3.err new file mode 100644 index 00000000..a4025c9d --- /dev/null +++ b/result/schemas/choice_0_3.err @@ -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 diff --git a/result/schemas/choice_0_4 b/result/schemas/choice_0_4 new file mode 100644 index 00000000..0643e3b2 --- /dev/null +++ b/result/schemas/choice_0_4 @@ -0,0 +1 @@ +./test/schemas/choice_4.xml fails to validate diff --git a/result/schemas/choice_0_4.err b/result/schemas/choice_0_4.err new file mode 100644 index 00000000..87ec6fbb --- /dev/null +++ b/result/schemas/choice_0_4.err @@ -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 diff --git a/result/schemas/po b/result/schemas/po deleted file mode 100644 index e69de29b..00000000 --- a/result/schemas/po +++ /dev/null diff --git a/result/schemas/po0_0_0 b/result/schemas/po0_0_0 new file mode 100644 index 00000000..9687b9de --- /dev/null +++ b/result/schemas/po0_0_0 @@ -0,0 +1 @@ +./test/schemas/po0_0.xml validates diff --git a/result/schemas/po0_0_0.err b/result/schemas/po0_0_0.err new file mode 100644 index 00000000..1707abab --- /dev/null +++ b/result/schemas/po0_0_0.err @@ -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 diff --git a/test/schemas/choice_0.xml b/test/schemas/choice_0.xml new file mode 100644 index 00000000..677b0390 --- /dev/null +++ b/test/schemas/choice_0.xml @@ -0,0 +1,3 @@ +<doc> +<a/> +</doc> diff --git a/test/schemas/choice_0.xsd b/test/schemas/choice_0.xsd new file mode 100644 index 00000000..7f690f47 --- /dev/null +++ b/test/schemas/choice_0.xsd @@ -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> diff --git a/test/schemas/choice_1.xml b/test/schemas/choice_1.xml new file mode 100644 index 00000000..d5c0dd1f --- /dev/null +++ b/test/schemas/choice_1.xml @@ -0,0 +1,3 @@ +<doc> +<b/> +</doc> diff --git a/test/schemas/choice_2.xml b/test/schemas/choice_2.xml new file mode 100644 index 00000000..7b27f17c --- /dev/null +++ b/test/schemas/choice_2.xml @@ -0,0 +1,4 @@ +<doc> +<a/> +<b/> +</doc> diff --git a/test/schemas/choice_3.xml b/test/schemas/choice_3.xml new file mode 100644 index 00000000..03581098 --- /dev/null +++ b/test/schemas/choice_3.xml @@ -0,0 +1,4 @@ +<doc> +<a/> +<a/> +</doc> diff --git a/test/schemas/choice_4.xml b/test/schemas/choice_4.xml new file mode 100644 index 00000000..636923c5 --- /dev/null +++ b/test/schemas/choice_4.xml @@ -0,0 +1,2 @@ +<doc> +</doc> diff --git a/test/schemas/po.xml b/test/schemas/po0_0.xml index 387232d1..387232d1 100644 --- a/test/schemas/po.xml +++ b/test/schemas/po0_0.xml diff --git a/test/schemas/po.xsd b/test/schemas/po0_0.xsd index 5a1e6608..5a1e6608 100644 --- a/test/schemas/po.xsd +++ b/test/schemas/po0_0.xsd diff --git a/testSchemas.c b/testSchemas.c index 31681676..40c0c8b6 100644 --- a/testSchemas.c +++ b/testSchemas.c @@ -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); } diff --git a/xmlschemas.c b/xmlschemas.c index f2110959..4ccc1f17 100644 --- a/xmlschemas.c +++ b/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); diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 4c8d4202..002cc7b0 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -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 } |