Commit 8651f536 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

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
parent e1eff383
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
......
......@@ -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,
......
./test/schemas/choice_0.xml validates
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
./test/schemas/choice_1.xml validates
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
./test/schemas/choice_2.xml fails to validate
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
./test/schemas/choice_3.xml fails to validate
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
./test/schemas/choice_4.xml fails to validate
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
./test/schemas/po0_0.xml validates
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
<?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>
<doc>
<a/>
<b/>
</doc>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment