summaryrefslogtreecommitdiff
path: root/xsd-tests
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-tests')
-rw-r--r--xsd-tests/.gitignore32
l---------xsd-tests/FLOSSE1
l---------xsd-tests/GPLv21
l---------xsd-tests/LICENSE1
-rw-r--r--xsd-tests/README8
-rw-r--r--xsd-tests/build/.gitignore3
-rw-r--r--xsd-tests/build/bootstrap.build9
-rw-r--r--xsd-tests/build/root.build40
-rw-r--r--xsd-tests/buildfile4
-rw-r--r--xsd-tests/clash/.gitignore2
-rw-r--r--xsd-tests/clash/buildfile27
-rw-r--r--xsd-tests/clash/clash.xsd25
-rw-r--r--xsd-tests/clash/driver.cxx10
-rw-r--r--xsd-tests/clash/foo.xsd11
-rw-r--r--xsd-tests/code/name-conflict/buildfile22
-rw-r--r--xsd-tests/code/name-conflict/driver.cxx9
-rw-r--r--xsd-tests/code/name-conflict/test.xsd40
-rw-r--r--xsd-tests/code/name-escaping/buildfile22
-rw-r--r--xsd-tests/code/name-escaping/driver.cxx9
-rw-r--r--xsd-tests/code/name-escaping/test.xsd60
-rw-r--r--xsd-tests/cxx/parser/.gitignore1
-rw-r--r--xsd-tests/cxx/parser/built-in/buildfile23
-rw-r--r--xsd-tests/cxx/parser/built-in/driver.cxx529
-rw-r--r--xsd-tests/cxx/parser/built-in/output164
-rw-r--r--xsd-tests/cxx/parser/built-in/test.xml199
-rw-r--r--xsd-tests/cxx/parser/built-in/test.xsd63
-rw-r--r--xsd-tests/cxx/parser/enumeration/buildfile24
-rw-r--r--xsd-tests/cxx/parser/enumeration/driver.cxx81
-rw-r--r--xsd-tests/cxx/parser/enumeration/gender.hxx13
-rw-r--r--xsd-tests/cxx/parser/enumeration/output3
-rw-r--r--xsd-tests/cxx/parser/enumeration/test.map7
-rw-r--r--xsd-tests/cxx/parser/enumeration/test.xml10
-rw-r--r--xsd-tests/cxx/parser/enumeration/test.xsd35
-rw-r--r--xsd-tests/cxx/parser/generated-impl/.gitignore2
-rw-r--r--xsd-tests/cxx/parser/generated-impl/buildfile31
-rw-r--r--xsd-tests/cxx/parser/generated-impl/output122
-rw-r--r--xsd-tests/cxx/parser/generated-impl/test.xml168
-rw-r--r--xsd-tests/cxx/parser/generated-impl/test.xsd142
-rw-r--r--xsd-tests/cxx/parser/list/buildfile23
-rw-r--r--xsd-tests/cxx/parser/list/driver.cxx105
-rw-r--r--xsd-tests/cxx/parser/list/output26
-rw-r--r--xsd-tests/cxx/parser/list/test.xml25
-rw-r--r--xsd-tests/cxx/parser/list/test.xsd25
-rw-r--r--xsd-tests/cxx/parser/name-clash/inheritance/buildfile24
-rw-r--r--xsd-tests/cxx/parser/name-clash/inheritance/driver.cxx62
-rw-r--r--xsd-tests/cxx/parser/name-clash/inheritance/output2
-rw-r--r--xsd-tests/cxx/parser/name-clash/inheritance/test.xml8
-rw-r--r--xsd-tests/cxx/parser/name-clash/inheritance/test.xsd22
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/buildfile24
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/driver.cxx68
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/output22
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.cxx147
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.hxx94
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/test.xml15
-rw-r--r--xsd-tests/cxx/parser/polymorphism/recursive/test.xsd53
-rw-r--r--xsd-tests/cxx/parser/polymorphism/same-type/buildfile24
-rw-r--r--xsd-tests/cxx/parser/polymorphism/same-type/driver.cxx62
-rw-r--r--xsd-tests/cxx/parser/polymorphism/same-type/output4
-rw-r--r--xsd-tests/cxx/parser/polymorphism/same-type/test.xml10
-rw-r--r--xsd-tests/cxx/parser/polymorphism/same-type/test.xsd21
-rw-r--r--xsd-tests/cxx/parser/recursive/buildfile24
-rw-r--r--xsd-tests/cxx/parser/recursive/driver.cxx139
-rw-r--r--xsd-tests/cxx/parser/recursive/output22
-rw-r--r--xsd-tests/cxx/parser/recursive/test.xml11
-rw-r--r--xsd-tests/cxx/parser/recursive/test.xsd27
-rw-r--r--xsd-tests/cxx/parser/test-template/buildfile23
-rw-r--r--xsd-tests/cxx/parser/test-template/driver.cxx66
-rw-r--r--xsd-tests/cxx/parser/test-template/output1
-rw-r--r--xsd-tests/cxx/parser/test-template/test.xml7
-rw-r--r--xsd-tests/cxx/parser/test-template/test.xsd12
-rw-r--r--xsd-tests/cxx/parser/union/buildfile23
-rw-r--r--xsd-tests/cxx/parser/union/driver.cxx60
-rw-r--r--xsd-tests/cxx/parser/union/output2
-rw-r--r--xsd-tests/cxx/parser/union/test.xml10
-rw-r--r--xsd-tests/cxx/parser/union/test.xsd16
-rw-r--r--xsd-tests/cxx/parser/validation/all/buildfile22
-rw-r--r--xsd-tests/cxx/parser/validation/all/driver.cxx98
-rw-r--r--xsd-tests/cxx/parser/validation/all/test.xsd20
-rw-r--r--xsd-tests/cxx/parser/validation/all/testscript190
-rw-r--r--xsd-tests/cxx/parser/validation/any/buildfile24
-rw-r--r--xsd-tests/cxx/parser/validation/any/driver.cxx121
-rw-r--r--xsd-tests/cxx/parser/validation/any/output29
-rw-r--r--xsd-tests/cxx/parser/validation/any/test.xml21
-rw-r--r--xsd-tests/cxx/parser/validation/any/test.xsd20
-rw-r--r--xsd-tests/cxx/parser/validation/attribute/buildfile24
-rw-r--r--xsd-tests/cxx/parser/validation/attribute/driver.cxx197
-rw-r--r--xsd-tests/cxx/parser/validation/attribute/output24
-rw-r--r--xsd-tests/cxx/parser/validation/attribute/test.xml10
-rw-r--r--xsd-tests/cxx/parser/validation/attribute/test.xsd71
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/any-type/buildfile24
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/any-type/driver.cxx154
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/any-type/output99
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/any-type/test.xml41
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/any-type/test.xsd31
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/binary/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/binary/driver.cxx153
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/boolean/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/boolean/driver.cxx145
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/byte/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/byte/driver.cxx256
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/date-time/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/date-time/driver.cxx1533
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/float/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/float/driver.cxx285
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/int/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/int/driver.cxx116
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/integer/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/integer/driver.cxx303
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/long/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/long/driver.cxx116
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/qname/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/qname/driver.cxx105
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/short/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/short/driver.cxx116
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/string/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/string/driver.cxx512
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/uri/buildfile10
-rw-r--r--xsd-tests/cxx/parser/validation/built-in/uri/driver.cxx53
-rw-r--r--xsd-tests/cxx/parser/validation/choice/buildfile22
-rw-r--r--xsd-tests/cxx/parser/validation/choice/driver.cxx126
-rw-r--r--xsd-tests/cxx/parser/validation/choice/test.xsd24
-rw-r--r--xsd-tests/cxx/parser/validation/choice/testscript179
-rw-r--r--xsd-tests/cxx/parser/validation/restriction/buildfile22
-rw-r--r--xsd-tests/cxx/parser/validation/restriction/driver.cxx107
-rw-r--r--xsd-tests/cxx/parser/validation/restriction/test.xsd82
-rw-r--r--xsd-tests/cxx/parser/validation/restriction/testscript159
-rw-r--r--xsd-tests/cxx/parser/validation/sequence/buildfile22
-rw-r--r--xsd-tests/cxx/parser/validation/sequence/driver.cxx139
-rw-r--r--xsd-tests/cxx/parser/validation/sequence/test.xsd28
-rw-r--r--xsd-tests/cxx/parser/validation/sequence/testscript328
-rw-r--r--xsd-tests/cxx/tree/any-type/buildfile26
-rw-r--r--xsd-tests/cxx/tree/any-type/driver.cxx144
-rw-r--r--xsd-tests/cxx/tree/any-type/output73
-rw-r--r--xsd-tests/cxx/tree/any-type/test.xml26
-rw-r--r--xsd-tests/cxx/tree/any-type/test.xsd19
-rw-r--r--xsd-tests/cxx/tree/binary/cdr/buildfile25
-rw-r--r--xsd-tests/cxx/tree/binary/cdr/driver.cxx143
-rw-r--r--xsd-tests/cxx/tree/binary/cdr/test.xml93
-rw-r--r--xsd-tests/cxx/tree/binary/cdr/test.xsd123
-rw-r--r--xsd-tests/cxx/tree/binary/polymorphic/buildfile27
-rw-r--r--xsd-tests/cxx/tree/binary/polymorphic/driver.cxx164
-rw-r--r--xsd-tests/cxx/tree/binary/polymorphic/test.xml92
-rw-r--r--xsd-tests/cxx/tree/binary/polymorphic/test.xsd125
-rw-r--r--xsd-tests/cxx/tree/binary/xdr-ordered/buildfile28
-rw-r--r--xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx206
-rw-r--r--xsd-tests/cxx/tree/binary/xdr-ordered/test.xml93
-rw-r--r--xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd123
-rw-r--r--xsd-tests/cxx/tree/binary/xdr/buildfile27
-rw-r--r--xsd-tests/cxx/tree/binary/xdr/driver.cxx204
-rw-r--r--xsd-tests/cxx/tree/binary/xdr/test.xml93
-rw-r--r--xsd-tests/cxx/tree/binary/xdr/test.xsd123
-rw-r--r--xsd-tests/cxx/tree/buildfile6
-rw-r--r--xsd-tests/cxx/tree/built-in/.gitignore1
-rw-r--r--xsd-tests/cxx/tree/built-in/buildfile25
-rw-r--r--xsd-tests/cxx/tree/built-in/driver.cxx93
-rw-r--r--xsd-tests/cxx/tree/built-in/testscript394
-rw-r--r--xsd-tests/cxx/tree/built-in/types.xsd460
-rw-r--r--xsd-tests/cxx/tree/chameleon/.gitignore1
-rw-r--r--xsd-tests/cxx/tree/chameleon/buildfile24
-rw-r--r--xsd-tests/cxx/tree/chameleon/driver.cxx35
-rw-r--r--xsd-tests/cxx/tree/chameleon/includee.xsd13
-rw-r--r--xsd-tests/cxx/tree/chameleon/includer.xsd12
-rw-r--r--xsd-tests/cxx/tree/chameleon/output3
-rw-r--r--xsd-tests/cxx/tree/chameleon/test.xml8
-rw-r--r--xsd-tests/cxx/tree/comparison/buildfile22
-rw-r--r--xsd-tests/cxx/tree/comparison/driver.cxx38
-rw-r--r--xsd-tests/cxx/tree/comparison/test.xml19
-rw-r--r--xsd-tests/cxx/tree/comparison/test.xsd30
-rw-r--r--xsd-tests/cxx/tree/compilation/buildfile20
-rw-r--r--xsd-tests/cxx/tree/compilation/driver.cxx116
-rw-r--r--xsd-tests/cxx/tree/compilation/test.xsd12
-rw-r--r--xsd-tests/cxx/tree/complex/ctor/buildfile25
-rw-r--r--xsd-tests/cxx/tree/complex/ctor/driver.cxx122
-rw-r--r--xsd-tests/cxx/tree/complex/ctor/test.xsd182
-rw-r--r--xsd-tests/cxx/tree/containment/buildfile20
-rw-r--r--xsd-tests/cxx/tree/containment/driver.cxx118
-rw-r--r--xsd-tests/cxx/tree/containment/test.xsd59
-rw-r--r--xsd-tests/cxx/tree/default/general/buildfile26
-rw-r--r--xsd-tests/cxx/tree/default/general/driver.cxx37
-rw-r--r--xsd-tests/cxx/tree/default/general/output15
-rw-r--r--xsd-tests/cxx/tree/default/general/test.xml16
-rw-r--r--xsd-tests/cxx/tree/default/general/test.xsd241
-rw-r--r--xsd-tests/cxx/tree/default/omit/buildfile27
-rw-r--r--xsd-tests/cxx/tree/default/omit/driver.cxx46
-rw-r--r--xsd-tests/cxx/tree/default/omit/output19
-rw-r--r--xsd-tests/cxx/tree/default/omit/test.xml9
-rw-r--r--xsd-tests/cxx/tree/default/omit/test.xsd30
-rw-r--r--xsd-tests/cxx/tree/detach/buildfile21
-rw-r--r--xsd-tests/cxx/tree/detach/driver.cxx108
-rw-r--r--xsd-tests/cxx/tree/detach/test.xsd32
-rw-r--r--xsd-tests/cxx/tree/dom-association/buildfile27
-rw-r--r--xsd-tests/cxx/tree/dom-association/dom-parse.cxx95
-rw-r--r--xsd-tests/cxx/tree/dom-association/dom-parse.hxx23
-rw-r--r--xsd-tests/cxx/tree/dom-association/driver.cxx71
-rw-r--r--xsd-tests/cxx/tree/dom-association/output0
-rw-r--r--xsd-tests/cxx/tree/dom-association/test.xml7
-rw-r--r--xsd-tests/cxx/tree/dom-association/test.xsd12
-rw-r--r--xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile25
-rw-r--r--xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx74
-rw-r--r--xsd-tests/cxx/tree/encoding/char/iso-8859-1/output10
-rw-r--r--xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml14
-rw-r--r--xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd31
-rw-r--r--xsd-tests/cxx/tree/encoding/char/lcp/buildfile24
-rw-r--r--xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx40
-rw-r--r--xsd-tests/cxx/tree/encoding/char/lcp/output4
-rw-r--r--xsd-tests/cxx/tree/encoding/char/lcp/test.xml7
-rw-r--r--xsd-tests/cxx/tree/encoding/char/lcp/test.xsd12
-rw-r--r--xsd-tests/cxx/tree/encoding/char/utf-8/buildfile24
-rw-r--r--xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx63
-rw-r--r--xsd-tests/cxx/tree/encoding/char/utf-8/output9
-rw-r--r--xsd-tests/cxx/tree/encoding/char/utf-8/test.xml13
-rw-r--r--xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd31
-rw-r--r--xsd-tests/cxx/tree/encoding/wchar/buildfile25
-rw-r--r--xsd-tests/cxx/tree/encoding/wchar/driver.cxx55
-rw-r--r--xsd-tests/cxx/tree/encoding/wchar/output10
-rw-r--r--xsd-tests/cxx/tree/encoding/wchar/test.xml14
-rw-r--r--xsd-tests/cxx/tree/encoding/wchar/test.xsd33
-rw-r--r--xsd-tests/cxx/tree/enumeration/ctor/buildfile22
-rw-r--r--xsd-tests/cxx/tree/enumeration/ctor/driver.cxx30
-rw-r--r--xsd-tests/cxx/tree/enumeration/ctor/test.xsd41
-rw-r--r--xsd-tests/cxx/tree/enumeration/inheritance/buildfile23
-rw-r--r--xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx53
-rw-r--r--xsd-tests/cxx/tree/enumeration/inheritance/output1
-rw-r--r--xsd-tests/cxx/tree/enumeration/inheritance/test.xml3
-rw-r--r--xsd-tests/cxx/tree/enumeration/inheritance/test.xsd22
-rw-r--r--xsd-tests/cxx/tree/float/buildfile24
-rw-r--r--xsd-tests/cxx/tree/float/driver.cxx53
-rw-r--r--xsd-tests/cxx/tree/float/output35
-rw-r--r--xsd-tests/cxx/tree/float/test.xml35
-rw-r--r--xsd-tests/cxx/tree/float/test.xsd74
-rw-r--r--xsd-tests/cxx/tree/list/ctor/buildfile22
-rw-r--r--xsd-tests/cxx/tree/list/ctor/driver.cxx50
-rw-r--r--xsd-tests/cxx/tree/list/ctor/test.xsd18
-rw-r--r--xsd-tests/cxx/tree/name-clash/inheritance/buildfile23
-rw-r--r--xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx35
-rw-r--r--xsd-tests/cxx/tree/name-clash/inheritance/output3
-rw-r--r--xsd-tests/cxx/tree/name-clash/inheritance/test.xml8
-rw-r--r--xsd-tests/cxx/tree/name-clash/inheritance/test.xsd53
-rw-r--r--xsd-tests/cxx/tree/naming/camel/buildfile25
-rw-r--r--xsd-tests/cxx/tree/naming/camel/driver.cxx154
-rw-r--r--xsd-tests/cxx/tree/naming/camel/test.xsd31
-rw-r--r--xsd-tests/cxx/tree/naming/java/buildfile25
-rw-r--r--xsd-tests/cxx/tree/naming/java/driver.cxx153
-rw-r--r--xsd-tests/cxx/tree/naming/java/test.xsd31
-rw-r--r--xsd-tests/cxx/tree/naming/knr/buildfile25
-rw-r--r--xsd-tests/cxx/tree/naming/knr/driver.cxx154
-rw-r--r--xsd-tests/cxx/tree/naming/knr/test.xsd31
-rw-r--r--xsd-tests/cxx/tree/order/buildfile37
-rw-r--r--xsd-tests/cxx/tree/order/driver.cxx64
-rw-r--r--xsd-tests/cxx/tree/order/output92
-rw-r--r--xsd-tests/cxx/tree/order/test.xml71
-rw-r--r--xsd-tests/cxx/tree/order/test.xsd130
-rw-r--r--xsd-tests/cxx/tree/polymorphism/comparison/buildfile25
-rw-r--r--xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx85
-rw-r--r--xsd-tests/cxx/tree/polymorphism/comparison/test.xml7
-rw-r--r--xsd-tests/cxx/tree/polymorphism/comparison/test.xsd39
-rw-r--r--xsd-tests/cxx/tree/polymorphism/ostream/buildfile26
-rw-r--r--xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx34
-rw-r--r--xsd-tests/cxx/tree/polymorphism/ostream/output18
-rw-r--r--xsd-tests/cxx/tree/polymorphism/ostream/test.xml10
-rw-r--r--xsd-tests/cxx/tree/polymorphism/ostream/test.xsd62
-rw-r--r--xsd-tests/cxx/tree/polymorphism/same-type/buildfile25
-rw-r--r--xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx35
-rw-r--r--xsd-tests/cxx/tree/polymorphism/same-type/output9
-rw-r--r--xsd-tests/cxx/tree/polymorphism/same-type/test.xml10
-rw-r--r--xsd-tests/cxx/tree/polymorphism/same-type/test.xsd21
-rw-r--r--xsd-tests/cxx/tree/prefix/.gitignore2
-rw-r--r--xsd-tests/cxx/tree/prefix/bar.xsd34
-rw-r--r--xsd-tests/cxx/tree/prefix/buildfile31
-rw-r--r--xsd-tests/cxx/tree/prefix/driver.cxx34
-rw-r--r--xsd-tests/cxx/tree/prefix/foo.xsd16
-rw-r--r--xsd-tests/cxx/tree/prefix/output18
-rw-r--r--xsd-tests/cxx/tree/prefix/test.xml19
-rw-r--r--xsd-tests/cxx/tree/prefix/test.xsd40
-rw-r--r--xsd-tests/cxx/tree/test-template/buildfile23
-rw-r--r--xsd-tests/cxx/tree/test-template/driver.cxx35
-rw-r--r--xsd-tests/cxx/tree/test-template/output2
-rw-r--r--xsd-tests/cxx/tree/test-template/test.xml7
-rw-r--r--xsd-tests/cxx/tree/test-template/test.xsd12
-rw-r--r--xsd-tests/cxx/tree/types-only/buildfile20
-rw-r--r--xsd-tests/cxx/tree/types-only/driver.cxx30
-rw-r--r--xsd-tests/cxx/tree/types-only/test.xsd52
-rw-r--r--xsd-tests/cxx/tree/union/ctor/buildfile22
-rw-r--r--xsd-tests/cxx/tree/union/ctor/driver.cxx30
-rw-r--r--xsd-tests/cxx/tree/union/ctor/test.xsd14
-rw-r--r--xsd-tests/cxx/tree/wildcard/buildfile27
-rw-r--r--xsd-tests/cxx/tree/wildcard/driver.cxx203
-rw-r--r--xsd-tests/cxx/tree/wildcard/output24
-rw-r--r--xsd-tests/cxx/tree/wildcard/test.xml19
-rw-r--r--xsd-tests/cxx/tree/wildcard/test.xsd18
-rw-r--r--xsd-tests/failed/.gitignore1
-rw-r--r--xsd-tests/failed/buildfile27
-rw-r--r--xsd-tests/failed/driver.cxx9
-rw-r--r--xsd-tests/failed/test-00.xsd12
-rw-r--r--xsd-tests/manifest15
-rw-r--r--xsd-tests/morphing/anonymous/attribute-group/buildfile22
-rw-r--r--xsd-tests/morphing/anonymous/attribute-group/driver.cxx9
-rw-r--r--xsd-tests/morphing/anonymous/attribute-group/test.xsd31
-rw-r--r--xsd-tests/morphing/anonymous/basic/buildfile22
-rw-r--r--xsd-tests/morphing/anonymous/basic/driver.cxx9
-rw-r--r--xsd-tests/morphing/anonymous/basic/test.xsd20
-rw-r--r--xsd-tests/morphing/anonymous/cyclic-inclusion/.gitignore2
-rw-r--r--xsd-tests/morphing/anonymous/cyclic-inclusion/buildfile27
-rw-r--r--xsd-tests/morphing/anonymous/cyclic-inclusion/driver.cxx10
-rw-r--r--xsd-tests/morphing/anonymous/cyclic-inclusion/includee.xsd18
-rw-r--r--xsd-tests/morphing/anonymous/cyclic-inclusion/includer.xsd18
-rw-r--r--xsd-tests/morphing/anonymous/group/buildfile22
-rw-r--r--xsd-tests/morphing/anonymous/group/driver.cxx9
-rw-r--r--xsd-tests/morphing/anonymous/group/test.xsd29
-rw-r--r--xsd-tests/morphing/anonymous/unstable/.gitignore1
-rw-r--r--xsd-tests/morphing/anonymous/unstable/buildfile31
-rw-r--r--xsd-tests/morphing/anonymous/unstable/includee-1.xsd12
-rw-r--r--xsd-tests/morphing/anonymous/unstable/includee-2.xsd14
-rw-r--r--xsd-tests/morphing/anonymous/unstable/includer.xsd18
-rw-r--r--xsd-tests/morphing/anonymous/unstable/testscript11
-rw-r--r--xsd-tests/processing/inheritance/.gitignore3
-rw-r--r--xsd-tests/processing/inheritance/buildfile36
-rw-r--r--xsd-tests/processing/inheritance/driver.cxx.in9
-rw-r--r--xsd-tests/processing/inheritance/test-000.xsd22
-rw-r--r--xsd-tests/processing/inheritance/test-001.xsd26
-rw-r--r--xsd-tests/schema/anonymous/buildfile22
-rw-r--r--xsd-tests/schema/anonymous/driver.cxx9
-rw-r--r--xsd-tests/schema/anonymous/test.xsd143
-rw-r--r--xsd-tests/schema/any-attribute/buildfile12
-rw-r--r--xsd-tests/schema/any-attribute/test.xsd22
-rw-r--r--xsd-tests/schema/any-attribute/testscript8
-rw-r--r--xsd-tests/schema/any-type/buildfile24
-rw-r--r--xsd-tests/schema/any-type/driver.cxx9
-rw-r--r--xsd-tests/schema/any-type/test.xsd22
-rw-r--r--xsd-tests/schema/any/.gitignore5
-rw-r--r--xsd-tests/schema/any/buildfile47
-rw-r--r--xsd-tests/schema/any/driver.cxx.in9
-rw-r--r--xsd-tests/schema/any/fail.xsd19
-rw-r--r--xsd-tests/schema/any/test.xsd19
-rw-r--r--xsd-tests/schema/attribute-group/.gitignore1
-rw-r--r--xsd-tests/schema/attribute-group/buildfile22
-rw-r--r--xsd-tests/schema/attribute-group/driver.cxx9
-rw-r--r--xsd-tests/schema/attribute-group/global.xsd50
-rw-r--r--xsd-tests/schema/attribute/.gitignore3
-rw-r--r--xsd-tests/schema/attribute/buildfile27
-rw-r--r--xsd-tests/schema/attribute/driver.cxx11
-rw-r--r--xsd-tests/schema/attribute/global.xsd21
-rw-r--r--xsd-tests/schema/attribute/local.xsd37
-rw-r--r--xsd-tests/schema/attribute/ref.xsd42
-rw-r--r--xsd-tests/schema/cardinality/buildfile22
-rw-r--r--xsd-tests/schema/cardinality/driver.cxx9
-rw-r--r--xsd-tests/schema/cardinality/test.xsd46
-rw-r--r--xsd-tests/schema/chameleon/.gitignore1
-rw-r--r--xsd-tests/schema/chameleon/buildfile27
-rw-r--r--xsd-tests/schema/chameleon/driver.cxx10
-rw-r--r--xsd-tests/schema/chameleon/includer.xsd17
-rw-r--r--xsd-tests/schema/chameleon/schemas/.gitignore1
-rw-r--r--xsd-tests/schema/chameleon/schemas/includee.xsd12
-rw-r--r--xsd-tests/schema/enumeration/buildfile22
-rw-r--r--xsd-tests/schema/enumeration/driver.cxx9
-rw-r--r--xsd-tests/schema/enumeration/test.xsd89
-rw-r--r--xsd-tests/schema/forward/buildfile22
-rw-r--r--xsd-tests/schema/forward/driver.cxx9
-rw-r--r--xsd-tests/schema/forward/test.xsd32
-rw-r--r--xsd-tests/schema/group/.gitignore1
-rw-r--r--xsd-tests/schema/group/buildfile27
-rw-r--r--xsd-tests/schema/group/driver.cxx10
-rw-r--r--xsd-tests/schema/group/global.xsd39
-rw-r--r--xsd-tests/schema/group/test.xsd148
-rw-r--r--xsd-tests/schema/import/.gitignore1
-rw-r--r--xsd-tests/schema/import/buildfile27
-rw-r--r--xsd-tests/schema/import/driver.cxx9
-rw-r--r--xsd-tests/schema/import/importer.xsd20
-rw-r--r--xsd-tests/schema/import/schemas/.gitignore1
-rw-r--r--xsd-tests/schema/import/schemas/importee.xsd15
-rw-r--r--xsd-tests/schema/include/.gitignore1
-rw-r--r--xsd-tests/schema/include/buildfile27
-rw-r--r--xsd-tests/schema/include/driver.cxx9
-rw-r--r--xsd-tests/schema/include/includer.xsd17
-rw-r--r--xsd-tests/schema/include/schemas/.gitignore1
-rw-r--r--xsd-tests/schema/include/schemas/includee.xsd14
-rw-r--r--xsd-tests/schema/inheritance/.gitignore1
-rw-r--r--xsd-tests/schema/inheritance/buildfile30
-rw-r--r--xsd-tests/schema/inheritance/cycle.xsd34
-rw-r--r--xsd-tests/schema/inheritance/sourced-forward/.gitignore1
-rw-r--r--xsd-tests/schema/inheritance/sourced-forward/includee.xsd10
-rw-r--r--xsd-tests/schema/inheritance/sourced-forward/includer.xsd14
-rw-r--r--xsd-tests/schema/inheritance/testscript8
-rw-r--r--xsd-tests/schema/list/anonymous/test.xsd16
-rw-r--r--xsd-tests/schema/list/any-simple-type/test.xsd12
-rw-r--r--xsd-tests/schema/list/buildfile31
-rw-r--r--xsd-tests/schema/list/test.xsd72
-rw-r--r--xsd-tests/schema/list/testscript8
-rw-r--r--xsd-tests/schema/no-namespace/buildfile22
-rw-r--r--xsd-tests/schema/no-namespace/driver.cxx9
-rw-r--r--xsd-tests/schema/no-namespace/test.xsd15
-rw-r--r--xsd-tests/schema/recursive/buildfile22
-rw-r--r--xsd-tests/schema/recursive/driver.cxx9
-rw-r--r--xsd-tests/schema/recursive/test.xsd43
-rw-r--r--xsd-tests/schema/ref-type/invalid/buildfile12
-rw-r--r--xsd-tests/schema/ref-type/invalid/invalid-0.xsd17
-rw-r--r--xsd-tests/schema/ref-type/invalid/invalid-1.xsd11
-rw-r--r--xsd-tests/schema/ref-type/invalid/testscript16
-rw-r--r--xsd-tests/schema/ref-type/valid/.gitignore6
-rw-r--r--xsd-tests/schema/ref-type/valid/buildfile35
-rw-r--r--xsd-tests/schema/ref-type/valid/driver.cxx.in9
-rw-r--r--xsd-tests/schema/ref-type/valid/idref.xsd42
-rw-r--r--xsd-tests/schema/ref-type/valid/idrefs.xsd43
-rw-r--r--xsd-tests/schema/restriction/buildfile22
-rw-r--r--xsd-tests/schema/restriction/driver.cxx9
-rw-r--r--xsd-tests/schema/restriction/test.xsd67
-rw-r--r--xsd-tests/schema/union/buildfile22
-rw-r--r--xsd-tests/schema/union/driver.cxx9
-rw-r--r--xsd-tests/schema/union/test.xsd65
409 files changed, 20062 insertions, 0 deletions
diff --git a/xsd-tests/.gitignore b/xsd-tests/.gitignore
new file mode 100644
index 0000000..d87c74c
--- /dev/null
+++ b/xsd-tests/.gitignore
@@ -0,0 +1,32 @@
+# Compiler/linker output.
+#
+*.d
+*.t
+*.i
+*.ii
+*.o
+*.obj
+*.so
+*.dll
+*.a
+*.lib
+*.exp
+*.pdb
+*.ilk
+*.exe
+*.exe.dlls/
+*.exe.manifest
+*.pc
+
+# Test executables.
+#
+driver
+
+# XSD-generated files.
+#
+test.?xx
+
+# Testscript output directories (can be symlinks).
+#
+test
+test-driver
diff --git a/xsd-tests/FLOSSE b/xsd-tests/FLOSSE
new file mode 120000
index 0000000..be6df3d
--- /dev/null
+++ b/xsd-tests/FLOSSE
@@ -0,0 +1 @@
+../FLOSSE \ No newline at end of file
diff --git a/xsd-tests/GPLv2 b/xsd-tests/GPLv2
new file mode 120000
index 0000000..08e5586
--- /dev/null
+++ b/xsd-tests/GPLv2
@@ -0,0 +1 @@
+../GPLv2 \ No newline at end of file
diff --git a/xsd-tests/LICENSE b/xsd-tests/LICENSE
new file mode 120000
index 0000000..ea5b606
--- /dev/null
+++ b/xsd-tests/LICENSE
@@ -0,0 +1 @@
+../LICENSE \ No newline at end of file
diff --git a/xsd-tests/README b/xsd-tests/README
new file mode 100644
index 0000000..1b529ab
--- /dev/null
+++ b/xsd-tests/README
@@ -0,0 +1,8 @@
+This package contains tests for the XSD to C++ data binding compiler.
+
+See the LICENSE file for distribution conditions.
+
+The project page is at https://www.codesynthesis.com/projects/xsd/.
+
+Send bug reports or any other feedback to the xsd-users@codesynthesis.com
+mailing list.
diff --git a/xsd-tests/build/.gitignore b/xsd-tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/xsd-tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/xsd-tests/build/bootstrap.build b/xsd-tests/build/bootstrap.build
new file mode 100644
index 0000000..49ad78f
--- /dev/null
+++ b/xsd-tests/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : build/bootstrap.build
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+project = xsd-tests
+
+using version
+using config
+using dist
+using test
diff --git a/xsd-tests/build/root.build b/xsd-tests/build/root.build
new file mode 100644
index 0000000..63c3bb4
--- /dev/null
+++ b/xsd-tests/build/root.build
@@ -0,0 +1,40 @@
+# file : build/root.build
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+define xsd: file
+xsd{*}: extension = xsd
+
+define xml: file
+xml{*}: extension = xml
+
+define map: file
+map{*}: extension = map
+
+using in
+
+cxx.std = latest
+
+using cxx
+
+hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
+cxx{*}: extension = cxx
+
+if ($cxx.target.system == 'win32-msvc')
+ cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+
+if ($cxx.class == 'msvc')
+ cxx.coptions += /wd4251 /wd4275 /wd4800
+
+# Setup the xsd that we are testing.
+#
+import xsd = xsd%exe{xsd}
+
+# Every exe{} in this project is by default a test.
+#
+exe{*}: test = true
+
+# Specify the test target for cross-testing.
+#
+test.target = $cxx.target
diff --git a/xsd-tests/buildfile b/xsd-tests/buildfile
new file mode 100644
index 0000000..e783791
--- /dev/null
+++ b/xsd-tests/buildfile
@@ -0,0 +1,4 @@
+# file : buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+./: {*/ -build/} doc{README} legal{GPLv2 LICENSE FLOSSE} manifest
diff --git a/xsd-tests/clash/.gitignore b/xsd-tests/clash/.gitignore
new file mode 100644
index 0000000..7349df1
--- /dev/null
+++ b/xsd-tests/clash/.gitignore
@@ -0,0 +1,2 @@
+clash.?xx
+foo.?xx
diff --git a/xsd-tests/clash/buildfile b/xsd-tests/clash/buildfile
new file mode 100644
index 0000000..e99dccf
--- /dev/null
+++ b/xsd-tests/clash/buildfile
@@ -0,0 +1,27 @@
+# file : clash/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = foo clash
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/clash/clash.xsd b/xsd-tests/clash/clash.xsd
new file mode 100644
index 0000000..8458908
--- /dev/null
+++ b/xsd-tests/clash/clash.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test/bar"
+ xmlns:f="http://www.codesynthesis.com/xmlns/test/foo"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test/bar">
+
+ <xsd:import namespace="http://www.codesynthesis.com/xmlns/test/foo" schemaLocation="foo.xsd"/>
+
+ <!-- example of a name clash. -->
+
+ <xsd:element name="foo" type="xsd:string"/>
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element ref="foo"/>
+ <xsd:element name="foo" type="xsd:long"/>
+ <xsd:element ref="f:foo"/>
+ <xsd:element ref="f:foo"/>
+ </xsd:sequence>
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/clash/driver.cxx b/xsd-tests/clash/driver.cxx
new file mode 100644
index 0000000..478e71a
--- /dev/null
+++ b/xsd-tests/clash/driver.cxx
@@ -0,0 +1,10 @@
+// file : clash/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "foo.hxx"
+#include "clash.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/clash/foo.xsd b/xsd-tests/clash/foo.xsd
new file mode 100644
index 0000000..8a06ba8
--- /dev/null
+++ b/xsd-tests/clash/foo.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test/foo"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test/foo">
+
+ <xsd:element name="foo" type="xsd:int"/>
+ <xsd:element name="bar" type="xsd:int"/>
+
+</xsd:schema>
diff --git a/xsd-tests/code/name-conflict/buildfile b/xsd-tests/code/name-conflict/buildfile
new file mode 100644
index 0000000..3a724f9
--- /dev/null
+++ b/xsd-tests/code/name-conflict/buildfile
@@ -0,0 +1,22 @@
+# file : code/name-conflict/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/code/name-conflict/driver.cxx b/xsd-tests/code/name-conflict/driver.cxx
new file mode 100644
index 0000000..a6eb4fe
--- /dev/null
+++ b/xsd-tests/code/name-conflict/driver.cxx
@@ -0,0 +1,9 @@
+// file : code/name-conflict/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/code/name-conflict/test.xsd b/xsd-tests/code/name-conflict/test.xsd
new file mode 100644
index 0000000..a017cc8
--- /dev/null
+++ b/xsd-tests/code/name-conflict/test.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:simpleType name="enumeration">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="enumeration"/>
+ <xsd:enumeration value="enumeration1"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:element name="enumeration" type="enumeration"/>
+
+ <xsd:complexType name="complex">
+ <xsd:sequence>
+ <xsd:element name="complex" type="xsd:string"/>
+ <xsd:element name="complex1" type="xsd:string"/>
+ <xsd:element name="type" type="xsd:string"/>
+ <xsd:element name="container" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="complex" type="complex"/>
+
+ <xsd:complexType name="anonymous">
+ <xsd:sequence>
+ <xsd:element name="anonymous">
+ <xsd:complexType> <!-- this is really twisted -->
+ <xsd:sequence>
+ <xsd:element name="anonymous2" type="xsd:string"/>
+ <xsd:element name="anonymous21" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="anonymous1" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="anonymous" type="anonymous"/>
+
+</xsd:schema>
diff --git a/xsd-tests/code/name-escaping/buildfile b/xsd-tests/code/name-escaping/buildfile
new file mode 100644
index 0000000..c252afd
--- /dev/null
+++ b/xsd-tests/code/name-escaping/buildfile
@@ -0,0 +1,22 @@
+# file : code/name-escaping/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/code/name-escaping/driver.cxx b/xsd-tests/code/name-escaping/driver.cxx
new file mode 100644
index 0000000..8d74030
--- /dev/null
+++ b/xsd-tests/code/name-escaping/driver.cxx
@@ -0,0 +1,9 @@
+// file : code/name-escaping/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/code/name-escaping/test.xsd b/xsd-tests/code/name-escaping/test.xsd
new file mode 100644
index 0000000..08c7530
--- /dev/null
+++ b/xsd-tests/code/name-escaping/test.xsd
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- type -->
+
+ <xsd:simpleType name="long">
+ <xsd:restriction base="xsd:long"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="strange.type-name.">
+ <xsd:restriction base="long"/>
+ </xsd:simpleType>
+
+ <xsd:element name="one-two-explicit">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="on.e-"/>
+ <xsd:enumeration value="t-wo."/>
+ <xsd:enumeration value="explicit"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+ <!-- element [global/local] -->
+
+ <xsd:element name="switch" type="long"/>
+ <xsd:element name="strange.element-name." type="strange.type-name."/>
+
+
+ <xsd:element name="with-anonymous-type-1">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="for" type="long"/>
+ <xsd:element name="switch" minOccurs="0" type="long"/>
+ <xsd:element name="strange.element-name." maxOccurs="unbounded" type="strange.type-name."/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <!-- attributes [global/local] -->
+
+ <xsd:attribute name="default" type="long"/>
+ <xsd:attribute name="strange.attribute-name." type="strange.type-name."/>
+
+ <xsd:element name="with-anonymous-type-2">
+ <xsd:complexType>
+ <xsd:attribute name="and" type="long" use="required"/>
+ <xsd:attribute name="strange.attribute-name." type="strange.type-name."/>
+ </xsd:complexType>
+ </xsd:element>
+
+
+</xsd:schema>
diff --git a/xsd-tests/cxx/parser/.gitignore b/xsd-tests/cxx/parser/.gitignore
new file mode 100644
index 0000000..5a7b950
--- /dev/null
+++ b/xsd-tests/cxx/parser/.gitignore
@@ -0,0 +1 @@
+*-pskel.?xx
diff --git a/xsd-tests/cxx/parser/built-in/buildfile b/xsd-tests/cxx/parser/built-in/buildfile
new file mode 100644
index 0000000..0522c9a
--- /dev/null
+++ b/xsd-tests/cxx/parser/built-in/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/parser/built-in/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/built-in/driver.cxx b/xsd-tests/cxx/parser/built-in/driver.cxx
new file mode 100644
index 0000000..008bc2d
--- /dev/null
+++ b/xsd-tests/cxx/parser/built-in/driver.cxx
@@ -0,0 +1,529 @@
+// file : cxx/parser/built-in/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test built-in type parsing.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+using xml_schema::ro_string;
+
+struct any_type_pimpl: xml_schema::any_type_pimpl
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ _start_any_element (ro_string const&,
+ ro_string const& n,
+ ro_string const*)
+ {
+ cout << " start any element '" << n << "'" << endl;
+ }
+
+ virtual void
+ _end_any_element (ro_string const&, ro_string const& n)
+ {
+ cout << " end any element '" << n << "'" << endl;
+ }
+
+ virtual void
+ _any_attribute (ro_string const&,
+ ro_string const& n,
+ ro_string const& v)
+ {
+ cout << " any attribute " << n << " = '" << v << "'" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& s)
+ {
+ cout << " any text: '" << s << "'" << endl;
+ }
+
+ virtual void
+ post_any_type ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct any_simple_type_pimpl: xml_schema::any_simple_type_pimpl
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& s)
+ {
+ cout << " any text: '" << s << "'" << endl;
+ }
+
+ virtual void
+ post_any_simple_type ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+ virtual void
+ boolean (bool v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ byte (signed char v)
+ {
+ cout << short (v) << endl;
+ }
+
+ virtual void
+ unsigned_byte (unsigned char v)
+ {
+ cout << (unsigned short) (v) << endl;
+ }
+
+ virtual void
+ short_ (short v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ unsigned_short (unsigned short v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ int_ (int v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ unsigned_int (unsigned int v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ long_ (long long v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ unsigned_long (unsigned long long v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ integer (long long v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ negative_integer (long long v)
+ {
+ cout << v << endl;
+ }
+
+
+ virtual void
+ non_positive_integer (long long v)
+ {
+ cout << v << endl;
+ }
+
+
+ virtual void
+ positive_integer (unsigned long long v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ non_negative_integer (unsigned long long v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ float_ (float v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ double_ (double v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ decimal (double v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ string (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ normalized_string (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ token (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ name (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ nmtoken (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ nmtokens (xml_schema::string_sequence const& s)
+ {
+ cout << "'";
+
+ for (xml_schema::string_sequence::const_iterator i (s.begin ());
+ i != s.end (); ++i)
+ cout << *i << " ";
+
+ cout << "'" << endl;
+ }
+
+ virtual void
+ ncname (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ id (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ idref (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ idrefs (xml_schema::string_sequence const& s)
+ {
+ cout << "'";
+
+ for (xml_schema::string_sequence::const_iterator i (s.begin ());
+ i != s.end (); ++i)
+ cout << *i << " ";
+
+ cout << "'" << endl;
+ }
+
+ virtual void
+ language (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ uri (std::string const& v)
+ {
+ cout << "'" << v << "'" << endl;
+ }
+
+ virtual void
+ qname (xml_schema::qname const& v)
+ {
+ cout << "'" << v.prefix () << ":" << v.name () << "'" << endl;
+ }
+
+ virtual void
+ base64_binary (XSD_AUTO_PTR<xml_schema::buffer> v)
+ {
+ std::string tmp (v->data (), v->size ());
+ cout << "'" << tmp << "'" << endl;
+ }
+
+ virtual void
+ hex_binary (XSD_AUTO_PTR<xml_schema::buffer> v)
+ {
+ std::string tmp (v->data (), v->size ());
+ cout << "'" << tmp << "'" << endl;
+ }
+
+ virtual void
+ gday (xml_schema::gday const& v)
+ {
+ cout << v.day ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ gmonth (xml_schema::gmonth const& v)
+ {
+ cout << v.month ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ gyear (xml_schema::gyear const& v)
+ {
+ cout << v.year ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ gmonth_day (xml_schema::gmonth_day const& v)
+ {
+ cout << v.month () << '-' << v.day ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ gyear_month (xml_schema::gyear_month const& v)
+ {
+ cout << v.year () << '-' << v.month ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ date (xml_schema::date const& v)
+ {
+ cout << v.year () << '-' << v.month () << '-' << v.day ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ time (xml_schema::time const& v)
+ {
+ cout << v.hours () << ':' << v.minutes () << ':' << v.seconds ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ date_time (xml_schema::date_time const& v)
+ {
+ cout << v.year () << '-' << v.month () << '-' << v.day () << 'T'
+ << v.hours () << ':' << v.minutes () << ':' << v.seconds ();
+
+ if (v.zone_present ())
+ cout << (v.zone_hours () < 0 ? "" : "+") << v.zone_hours ()
+ << ':' << v.zone_minutes ();
+
+ cout << endl;
+ }
+
+ virtual void
+ duration (xml_schema::duration const& v)
+ {
+ cout << (v.negative () ? "-" : "") << 'P'
+ << v.years () << 'Y'
+ << v.months () << 'M'
+ << v.days () << 'D'
+ << 'T'
+ << v.hours () << 'H'
+ << v.minutes () << 'M'
+ << v.seconds () << 'S'
+ << endl;
+ }
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ any_type_pimpl any_type_p;
+ any_simple_type_pimpl any_simple_type_p;
+
+ xml_schema::boolean_pimpl boolean_p;
+
+ xml_schema::byte_pimpl byte_p;
+ xml_schema::unsigned_byte_pimpl unsigned_byte_p;
+ xml_schema::short_pimpl short_p;
+ xml_schema::unsigned_short_pimpl unsigned_short_p;
+ xml_schema::int_pimpl int_p;
+ xml_schema::unsigned_int_pimpl unsigned_int_p;
+ xml_schema::long_pimpl long_p;
+ xml_schema::unsigned_long_pimpl unsigned_long_p;
+
+ xml_schema::integer_pimpl integer_p;
+ xml_schema::negative_integer_pimpl negative_integer_p;
+ xml_schema::non_positive_integer_pimpl non_positive_integer_p;
+ xml_schema::positive_integer_pimpl positive_integer_p;
+ xml_schema::non_negative_integer_pimpl non_negative_integer_p;
+
+ xml_schema::float_pimpl float_p;
+ xml_schema::double_pimpl double_p;
+ xml_schema::decimal_pimpl decimal_p;
+
+ xml_schema::string_pimpl string_p;
+ xml_schema::normalized_string_pimpl normalized_string_p;
+ xml_schema::token_pimpl token_p;
+ xml_schema::name_pimpl name_p;
+ xml_schema::nmtoken_pimpl nmtoken_p;
+ xml_schema::nmtokens_pimpl nmtokens_p;
+ xml_schema::ncname_pimpl ncname_p;
+ xml_schema::id_pimpl id_p;
+ xml_schema::idref_pimpl idref_p;
+ xml_schema::idrefs_pimpl idrefs_p;
+
+ xml_schema::language_pimpl language_p;
+ xml_schema::uri_pimpl uri_p;
+ xml_schema::qname_pimpl qname_p;
+
+ xml_schema::base64_binary_pimpl base64_binary_p;
+ xml_schema::hex_binary_pimpl hex_binary_p;
+
+ xml_schema::gday_pimpl gday_p;
+ xml_schema::gmonth_pimpl gmonth_p;
+ xml_schema::gyear_pimpl gyear_p;
+ xml_schema::gmonth_day_pimpl gmonth_day_p;
+ xml_schema::gyear_month_pimpl gyear_month_p;
+ xml_schema::date_pimpl date_p;
+ xml_schema::time_pimpl time_p;
+ xml_schema::date_time_pimpl date_time_p;
+ xml_schema::duration_pimpl duration_p;
+
+ type_pimpl type_p;
+
+ type_p.parsers (any_type_p,
+ any_simple_type_p,
+ boolean_p,
+ byte_p,
+ unsigned_byte_p,
+ short_p,
+ unsigned_short_p,
+ int_p,
+ unsigned_int_p,
+ long_p,
+ unsigned_long_p,
+ integer_p,
+ negative_integer_p,
+ non_positive_integer_p,
+ positive_integer_p,
+ non_negative_integer_p,
+ float_p,
+ double_p,
+ decimal_p,
+ string_p,
+ normalized_string_p,
+ token_p,
+ name_p,
+ nmtoken_p,
+ nmtokens_p,
+ ncname_p,
+ id_p,
+ idref_p,
+ idrefs_p,
+ language_p,
+ uri_p,
+ qname_p,
+ base64_binary_p,
+ hex_binary_p,
+ gday_p,
+ gmonth_p,
+ gyear_p,
+ gmonth_day_p,
+ gyear_month_p,
+ date_p,
+ time_p,
+ date_time_p,
+ duration_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ type_p.pre ();
+ doc_p.parse (argv[1]);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/built-in/output b/xsd-tests/cxx/parser/built-in/output
new file mode 100644
index 0000000..756abcd
--- /dev/null
+++ b/xsd-tests/cxx/parser/built-in/output
@@ -0,0 +1,164 @@
+{
+ any attribute x = 'x'
+ any text: '
+ '
+ start any element 'a'
+ any text: 'a'
+ end any element 'a'
+ any text: '
+ '
+ start any element 'any-type'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any-type'
+ any text: '
+ '
+}
+
+{
+ any text: '123abc'
+}
+
+1
+0
+1
+0
+0
+127
+-128
+123
+0
+255
+123
+0
+32767
+-32768
+-12345
+0
+65535
+12345
+0
+2147483647
+-2147483648
+-1234567890
+0
+4294967295
+1234567890
+0
+9223372036854775807
+-9223372036854775808
+-1234567890123456789
+0
+18446744073709551615
+12345678901234567890
+0
+2147483647
+-2147483648
+-1234567890
+-2147483648
+-1234567890
+0
+-2147483648
+-1234567890
+4294967295
+1234567890
+0
+4294967295
+1234567890
+0
+0
+-0
+inf
+-inf
+nan
+123.567
+123.567
+-1.23567e+07
+-4.5e-06
+0
+0
+-0
+inf
+-inf
+nan
+123.567
+123.567
+-1.23567e+07
+-4.5e-06
+0
+0
+-0
+123.567
+123.567
+-123.567
+'string space
+newline
+ '
+' string space newline '
+'string space newline'
+'as123:345-.abs'
+'1as123:345-.abs'
+'abc 123 '
+'as123_345-.abs'
+'as123_345-.abs'
+'abc'
+'a123'
+'as123_345-.abs'
+'abc a123 '
+'x'
+'en'
+'en-us'
+'one-two-three-four44-seven77-eight888'
+''
+'relative'
+'#id'
+'http://www.example.com/foo#bar'
+':schemaLocation'
+'xsi:schemaLocation'
+'12345abcjk'
+'a'
+'ab'
+'abc'
+''
+'12345abcjk'
+12+12:0
+1
+31
+15+0:0
+15-14:0
+10+12:0
+1
+12+0:0
+2007+12:0
+1
+-20000+0:0
+10-28+12:0
+12-31
+1-1+0:0
+2007-12+12:0
+-2007-10
+20007-10+0:0
+-20007-1
+2007-12-26+12:0
+-2007-10-15
+20007-12-31+0:0
+-20007-1-1
+12:46:23.456+12:0
+12:13:14
+12:13:14+0:0
+2007-12-26T12:13:14.123+12:0
+-2007-10-15T12:13:14
+20007-12-31T12:13:14+0:0
+-20007-1-1T12:13:14
+-P2007Y13M32DT25H61M61.123S
+P1Y0M0DT0H0M0S
+P0Y1M0DT0H0M0S
+P0Y0M1DT0H0M0S
+P0Y0M0DT1H0M0S
+P0Y0M0DT0H1M0S
+P0Y0M0DT0H0M1.1S
+P1Y0M0DT0H0M1S
diff --git a/xsd-tests/cxx/parser/built-in/test.xml b/xsd-tests/cxx/parser/built-in/test.xml
new file mode 100644
index 0000000..8d9332a
--- /dev/null
+++ b/xsd-tests/cxx/parser/built-in/test.xml
@@ -0,0 +1,199 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <any-type x="x">
+ <a>a</a>
+ <any-type x="xxx">aaa<a>bbb</a>ccc</any-type>
+ </any-type>
+
+ <any-simple-type>123abc</any-simple-type>
+
+ <boolean>1</boolean>
+ <boolean> 0 </boolean>
+ <boolean>true</boolean>
+ <boolean> false </boolean>
+
+ <byte>0</byte>
+ <byte>+127</byte>
+ <byte>-128</byte>
+ <byte> 123 </byte>
+
+ <unsigned-byte>0</unsigned-byte>
+ <unsigned-byte>255</unsigned-byte>
+ <unsigned-byte> 123 </unsigned-byte>
+
+ <short>0</short>
+ <short>+32767</short>
+ <short>-32768</short>
+ <short> -12345 </short>
+
+ <unsigned-short>0</unsigned-short>
+ <unsigned-short>65535</unsigned-short>
+ <unsigned-short> 12345 </unsigned-short>
+
+ <int>0</int>
+ <int>+2147483647</int>
+ <int>-2147483648</int>
+ <int> -1234567890 </int>
+
+ <unsigned-int>0</unsigned-int>
+ <unsigned-int>4294967295</unsigned-int>
+ <unsigned-int> 1234567890 </unsigned-int>
+
+ <long>0</long>
+ <long>+9223372036854775807</long>
+ <long>-9223372036854775808</long>
+ <long> -1234567890123456789 </long>
+
+ <unsigned-long>0</unsigned-long>
+ <unsigned-long>18446744073709551615</unsigned-long>
+ <unsigned-long> 12345678901234567890 </unsigned-long>
+
+ <integer>0</integer>
+ <integer> +2147483647 </integer>
+ <integer>-02147483648</integer>
+ <integer>-1234567890</integer>
+
+ <negative-integer>-02147483648</negative-integer>
+ <negative-integer> -1234567890 </negative-integer>
+
+ <non-positive-integer>0</non-positive-integer>
+ <non-positive-integer>-02147483648</non-positive-integer>
+ <non-positive-integer> -1234567890 </non-positive-integer>
+
+ <positive-integer>4294967295</positive-integer>
+ <positive-integer> +01234567890 </positive-integer>
+
+ <non-negative-integer>0</non-negative-integer>
+ <non-negative-integer>4294967295</non-negative-integer>
+ <non-negative-integer> +01234567890 </non-negative-integer>
+
+ <float>0</float>
+ <float>+0</float>
+ <float>-0</float>
+ <float>INF</float>
+ <float>-INF</float>
+ <float>NaN</float>
+ <float> 123.567 </float>
+ <float>+123.567</float>
+ <float>-123.567e5</float>
+ <float>-.45E-5</float>
+
+ <double>0</double>
+ <double>+0</double>
+ <double>-0</double>
+ <double>INF</double>
+ <double>-INF</double>
+ <double>NaN</double>
+ <double> 123.567 </double>
+ <double>+123.567</double>
+ <double>-123.567e5</double>
+ <double>-.45E-5</double>
+
+ <decimal>0</decimal>
+ <decimal>+0</decimal>
+ <decimal>-0</decimal>
+ <decimal> 123.567 </decimal>
+ <decimal>+123.567</decimal>
+ <decimal>-123.567</decimal>
+
+ <string>string space
+newline
+ </string>
+
+ <normalized-string> string space
+newline
+
+ </normalized-string>
+
+ <token> string space
+newline
+
+ </token>
+
+ <name> as123:345-.abs </name>
+
+ <nmtoken> 1as123:345-.abs </nmtoken>
+
+ <nmtokens> abc 123 </nmtokens>
+
+ <ncname> as123_345-.abs </ncname>
+
+ <id> as123_345-.abs </id>
+ <id> abc </id>
+ <id> a123 </id>
+
+ <idref> as123_345-.abs </idref>
+
+ <idrefs> abc a123 </idrefs>
+
+ <language> x </language>
+ <language> en </language>
+ <language> en-us </language>
+ <language>one-two-three-four44-seven77-eight888</language>
+
+ <uri> </uri>
+ <uri> relative </uri>
+ <uri> #id </uri>
+ <uri> http://www.example.com/foo#bar </uri>
+
+ <qname>schemaLocation</qname>
+ <qname>xsi:schemaLocation</qname>
+
+ <base64_binary> MTIzND
+ VhYmNqaw = =</base64_binary>
+ <base64_binary>YQ==</base64_binary>
+ <base64_binary>YWI=</base64_binary>
+ <base64_binary>YWJj</base64_binary>
+
+ <hex_binary> </hex_binary>
+ <hex_binary> 31323334356162636a6b </hex_binary>
+
+ <gday> ---12+12:00 </gday>
+ <gday>---01</gday>
+ <gday>---31</gday>
+ <gday>---15Z</gday>
+ <gday>---15-14:00</gday>
+
+ <gmonth> --10+12:00 </gmonth>
+ <gmonth>--01</gmonth>
+ <gmonth>--12Z</gmonth>
+
+ <gyear> 2007+12:00 </gyear>
+ <gyear>0001</gyear>
+ <gyear>-20000Z</gyear>
+
+ <gmonth_day> --10-28+12:00 </gmonth_day>
+ <gmonth_day>--12-31</gmonth_day>
+ <gmonth_day>--01-01Z</gmonth_day>
+
+ <gyear_month> 2007-12+12:00 </gyear_month>
+ <gyear_month>-2007-10</gyear_month>
+ <gyear_month>20007-10Z</gyear_month>
+ <gyear_month>-20007-01</gyear_month>
+
+ <date> 2007-12-26+12:00 </date>
+ <date>-2007-10-15</date>
+ <date>20007-12-31Z</date>
+ <date>-20007-01-01</date>
+
+ <time> 12:46:23.456+12:00 </time>
+ <time>12:13:14</time>
+ <time>12:13:14Z</time>
+
+ <date_time> 2007-12-26T12:13:14.123+12:00 </date_time>
+ <date_time>-2007-10-15T12:13:14</date_time>
+ <date_time>20007-12-31T12:13:14Z</date_time>
+ <date_time>-20007-01-01T12:13:14</date_time>
+
+ <duration> -P2007Y13M32DT25H61M61.123S </duration>
+ <duration>P1Y</duration>
+ <duration>P1M</duration>
+ <duration>P1D</duration>
+ <duration>PT1H</duration>
+ <duration>PT1M</duration>
+ <duration>PT1.1S</duration>
+ <duration>P1YT1S</duration>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/built-in/test.xsd b/xsd-tests/cxx/parser/built-in/test.xsd
new file mode 100644
index 0000000..9c00eb4
--- /dev/null
+++ b/xsd-tests/cxx/parser/built-in/test.xsd
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <element name="any-type" type="anyType" maxOccurs="unbounded"/>
+ <element name="any-simple-type" type="anySimpleType" maxOccurs="unbounded"/>
+
+ <element name="boolean" type="boolean" maxOccurs="unbounded"/>
+
+ <element name="byte" type="byte" maxOccurs="unbounded"/>
+ <element name="unsigned-byte" type="unsignedByte" maxOccurs="unbounded"/>
+ <element name="short" type="short" maxOccurs="unbounded"/>
+ <element name="unsigned-short" type="unsignedShort" maxOccurs="unbounded"/>
+ <element name="int" type="int" maxOccurs="unbounded"/>
+ <element name="unsigned-int" type="unsignedInt" maxOccurs="unbounded"/>
+ <element name="long" type="long" maxOccurs="unbounded"/>
+ <element name="unsigned-long" type="unsignedLong" maxOccurs="unbounded"/>
+
+ <element name="integer" type="integer" maxOccurs="unbounded"/>
+ <element name="negative-integer" type="negativeInteger" maxOccurs="unbounded"/>
+ <element name="non-positive-integer" type="nonPositiveInteger" maxOccurs="unbounded"/>
+ <element name="positive-integer" type="positiveInteger" maxOccurs="unbounded"/>
+ <element name="non-negative-integer" type="nonNegativeInteger" maxOccurs="unbounded"/>
+
+ <element name="float" type="float" maxOccurs="unbounded"/>
+ <element name="double" type="double" maxOccurs="unbounded"/>
+ <element name="decimal" type="decimal" maxOccurs="unbounded"/>
+
+ <element name="string" type="string" maxOccurs="unbounded"/>
+ <element name="normalized-string" type="normalizedString" maxOccurs="unbounded"/>
+ <element name="token" type="token" maxOccurs="unbounded"/>
+ <element name="name" type="Name" maxOccurs="unbounded"/>
+ <element name="nmtoken" type="NMTOKEN" maxOccurs="unbounded"/>
+ <element name="nmtokens" type="NMTOKENS" maxOccurs="unbounded"/>
+ <element name="ncname" type="NCName" maxOccurs="unbounded"/>
+ <element name="id" type="ID" maxOccurs="unbounded"/>
+ <element name="idref" type="IDREF" maxOccurs="unbounded"/>
+ <element name="idrefs" type="IDREFS" maxOccurs="unbounded"/>
+
+ <element name="language" type="language" maxOccurs="unbounded"/>
+ <element name="uri" type="anyURI" maxOccurs="unbounded"/>
+ <element name="qname" type="QName" maxOccurs="unbounded"/>
+
+ <element name="base64_binary" type="base64Binary" maxOccurs="unbounded"/>
+ <element name="hex_binary" type="hexBinary" maxOccurs="unbounded"/>
+
+ <element name="gday" type="gDay" maxOccurs="unbounded"/>
+ <element name="gmonth" type="gMonth" maxOccurs="unbounded"/>
+ <element name="gyear" type="gYear" maxOccurs="unbounded"/>
+ <element name="gmonth_day" type="gMonthDay" maxOccurs="unbounded"/>
+ <element name="gyear_month" type="gYearMonth" maxOccurs="unbounded"/>
+ <element name="date" type="date" maxOccurs="unbounded"/>
+ <element name="time" type="time" maxOccurs="unbounded"/>
+ <element name="date_time" type="dateTime" maxOccurs="unbounded"/>
+ <element name="duration" type="duration" maxOccurs="unbounded"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/enumeration/buildfile b/xsd-tests/cxx/parser/enumeration/buildfile
new file mode 100644
index 0000000..05163df
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/enumeration/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} map{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --type-map $path($<[1]) \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base" "-I$src_base"
diff --git a/xsd-tests/cxx/parser/enumeration/driver.cxx b/xsd-tests/cxx/parser/enumeration/driver.cxx
new file mode 100644
index 0000000..4776ee2
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/driver.cxx
@@ -0,0 +1,81 @@
+// file : cxx/parser/enumeration/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test xsd:enumeration parsing.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace xml_schema;
+
+struct digit_pimpl: test::digit_pskel, int_pimpl
+{
+};
+
+struct gender_pimpl: test::gender_pskel, string_pimpl
+{
+ virtual ::gender
+ post_gender ()
+ {
+ std::string str (post_string ());
+
+ if (str == "male")
+ return male;
+ else
+ return female;
+ }
+};
+
+struct type_pimpl: test::type_pskel
+{
+ virtual void
+ digit (int i)
+ {
+ cout << i << endl;
+ }
+
+ virtual void
+ gender (::gender g)
+ {
+ cout << g << endl;
+ }
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ digit_pimpl digit_p;
+ gender_pimpl gender_p;
+ type_pimpl type_p;
+
+ type_p.parsers (digit_p, gender_p);
+
+ document doc_p (type_p, "test", "root");
+
+ type_p.pre ();
+ doc_p.parse (argv[1]);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/enumeration/gender.hxx b/xsd-tests/cxx/parser/enumeration/gender.hxx
new file mode 100644
index 0000000..a2e5cd8
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/gender.hxx
@@ -0,0 +1,13 @@
+// file : tests/cxx/parser/enumeration/gender.hxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef GENDER_HXX
+#define GENDER_HXX
+
+enum gender
+{
+ male,
+ female
+};
+
+#endif // GENDER_HXX
diff --git a/xsd-tests/cxx/parser/enumeration/output b/xsd-tests/cxx/parser/enumeration/output
new file mode 100644
index 0000000..16db301
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/output
@@ -0,0 +1,3 @@
+1
+0
+1
diff --git a/xsd-tests/cxx/parser/enumeration/test.map b/xsd-tests/cxx/parser/enumeration/test.map
new file mode 100644
index 0000000..f8868d6
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/test.map
@@ -0,0 +1,7 @@
+namespace test
+{
+ include "gender.hxx";
+
+ digit int int;
+ gender ::gender ::gender;
+}
diff --git a/xsd-tests/cxx/parser/enumeration/test.xml b/xsd-tests/cxx/parser/enumeration/test.xml
new file mode 100644
index 0000000..a6fa893
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/test.xml
@@ -0,0 +1,10 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <digit>1</digit>
+
+ <gender>male</gender>
+ <gender>female</gender>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/enumeration/test.xsd b/xsd-tests/cxx/parser/enumeration/test.xsd
new file mode 100644
index 0000000..ded3a18
--- /dev/null
+++ b/xsd-tests/cxx/parser/enumeration/test.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="digit">
+ <restriction base="int">
+ <enumeration value="0"/>
+ <enumeration value="1"/>
+ <enumeration value="2"/>
+ <enumeration value="3"/>
+ <enumeration value="4"/>
+ <enumeration value="5"/>
+ <enumeration value="6"/>
+ <enumeration value="7"/>
+ <enumeration value="8"/>
+ <enumeration value="9"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="gender">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <choice maxOccurs="unbounded">
+ <element name="digit" type="t:digit"/>
+ <element name="gender" type="t:gender"/>
+ </choice>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/generated-impl/.gitignore b/xsd-tests/cxx/parser/generated-impl/.gitignore
new file mode 100644
index 0000000..21b434c
--- /dev/null
+++ b/xsd-tests/cxx/parser/generated-impl/.gitignore
@@ -0,0 +1,2 @@
+test-pimpl.?xx
+test-driver.?xx
diff --git a/xsd-tests/cxx/parser/generated-impl/buildfile b/xsd-tests/cxx/parser/generated-impl/buildfile
new file mode 100644
index 0000000..8710a77
--- /dev/null
+++ b/xsd-tests/cxx/parser/generated-impl/buildfile
@@ -0,0 +1,31 @@
+# file : cxx/parser/generated-impl/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx ixx cxx}{test-pskel} \
+ {hxx cxx}{test-pimpl} \
+ { cxx}{test-driver} \
+ $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel} \
+ {hxx cxx}{test-pimpl} \
+ { cxx}{test-driver}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --generate-print-impl \
+ --generate-test-driver \
+ --force-overwrite \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/generated-impl/output b/xsd-tests/cxx/parser/generated-impl/output
new file mode 100644
index 0000000..7c58647
--- /dev/null
+++ b/xsd-tests/cxx/parser/generated-impl/output
@@ -0,0 +1,122 @@
+gender: male
+foo: foo
+gender: male
+int: 0
+int: 1
+int: 2
+int: 3
+foo: foo
+int: 3
+int: 2
+int: 1
+int: 0
+union: 9
+foo: foo
+union: string
+x: x
+a: aaa
+x: x
+y: y
+a: aaa
+b: bbb
+boolean: 1
+boolean: 0
+boolean: 1
+boolean: 0
+byte: 0
+byte: 123
+byte: -123
+unsigned-byte: 0
+unsigned-byte: 123
+short: 0
+short: -1234
+short: 1234
+unsigned-short: 0
+unsigned-short: 1234
+int: 0
+int: -12345
+int: 12345
+unsigned-int: 0
+unsigned-int: 12345
+long: 0
+long: -123456
+long: 123456
+unsigned-long: 0
+unsigned-long: 123456
+integer: 0
+integer: -123456
+integer: 123456
+negative-integer: -123456
+non-positive-integer: 0
+non-positive-integer: -123456
+positive-integer: 123456
+non-negative-integer: 0
+non-negative-integer: 123456
+float: 0
+float: 1.123
+float: -1.123
+double: 0
+double: 1.1234
+double: -1.1234
+decimal: 0
+decimal: 1.1234
+decimal: -1.1234
+string: string space newline
+normalized-string: string space newline
+token: string space newline
+name: as123:345-.abs
+nmtoken: 1as123:345-.abs
+nmtokens: abc 123
+ncname: as123_345-.abs
+id: abc
+id: a123
+idref: abc
+idrefs: abc a123
+language: en
+language: en-us
+uri: http://www.example.com/foo#bar
+qname: schemaLocation
+qname: xsi:schemaLocation
+base64_binary: 10 bytes
+base64_binary: 1 bytes
+base64_binary: 2 bytes
+base64_binary: 3 bytes
+hex_binary: 0 bytes
+hex_binary: 10 bytes
+gday: ---12+12:0
+gday: ---1
+gday: ---31
+gday: ---15+0:0
+gday: ---15-14:0
+gmonth: --10+12:0
+gmonth: --1
+gmonth: --12+0:0
+gyear: 2007+12:0
+gyear: 1
+gyear: -20000+0:0
+gmonth_day: --10-28+12:0
+gmonth_day: --12-31
+gmonth_day: --1-1+0:0
+gyear_month: 2007-12+12:0
+gyear_month: -2007-10
+gyear_month: 20007-10+0:0
+gyear_month: -20007-1
+date: 2007-12-26+12:0
+date: -2007-10-15
+date: 20007-12-31+0:0
+date: -20007-1-1
+time: 12:46:23.456+12:0
+time: 12:13:14
+time: 12:13:14+0:0
+date_time: 2007-12-26T12:13:14.123+12:0
+date_time: -2007-10-15T12:13:14
+date_time: 20007-12-31T12:13:14+0:0
+date_time: -20007-1-1T12:13:14
+duration: -P2007Y13M32DT25H61M61.123S
+duration: P1Y0M0DT0H0M0S
+duration: P0Y1M0DT0H0M0S
+duration: P0Y0M1DT0H0M0S
+duration: P0Y0M0DT1H0M0S
+duration: P0Y0M0DT0H1M0S
+duration: P0Y0M0DT0H0M1.1S
+duration: P1Y0M0DT0H0M1S
diff --git a/xsd-tests/cxx/parser/generated-impl/test.xml b/xsd-tests/cxx/parser/generated-impl/test.xml
new file mode 100644
index 0000000..2f29a39
--- /dev/null
+++ b/xsd-tests/cxx/parser/generated-impl/test.xml
@@ -0,0 +1,168 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <gender>male</gender>
+ <gender-extension foo="foo">male</gender-extension>
+
+ <list>0 1 2 3</list>
+ <list-extension foo="foo">3 2 1 0</list-extension>
+
+ <union>9</union>
+ <union-extension foo="foo">string</union-extension>
+
+ <complex x="x">
+ <a>aaa</a>
+ </complex>
+
+ <complex-extension x="x" y="y">
+ <a>aaa</a>
+ <b>bbb</b>
+ </complex-extension>
+
+ <any-type>aaa<b>bbb</b>ccc</any-type>
+ <any-simple-type>abc123</any-simple-type>
+
+ <boolean>1</boolean>
+ <boolean> 0 </boolean>
+ <boolean>true</boolean>
+ <boolean> false </boolean>
+
+ <byte>0</byte>
+ <byte>123</byte>
+ <byte>-123</byte>
+
+ <unsigned-byte>0</unsigned-byte>
+ <unsigned-byte>123</unsigned-byte>
+
+ <short>0</short>
+ <short>-1234</short>
+ <short>1234</short>
+
+ <unsigned-short>0</unsigned-short>
+ <unsigned-short>1234</unsigned-short>
+
+ <int>0</int>
+ <int>-12345</int>
+ <int>12345</int>
+
+ <unsigned-int>0</unsigned-int>
+ <unsigned-int>12345</unsigned-int>
+
+ <long>0</long>
+ <long>-123456</long>
+ <long>123456</long>
+
+ <unsigned-long>0</unsigned-long>
+ <unsigned-long>123456</unsigned-long>
+
+ <integer>0</integer>
+ <integer>-123456</integer>
+ <integer>123456</integer>
+
+ <negative-integer>-123456</negative-integer>
+
+ <non-positive-integer>0</non-positive-integer>
+ <non-positive-integer>-123456</non-positive-integer>
+
+ <positive-integer>123456</positive-integer>
+
+ <non-negative-integer>0</non-negative-integer>
+ <non-negative-integer>123456</non-negative-integer>
+
+ <float>0</float>
+ <float>1.123</float>
+ <float>-1.123</float>
+
+ <double>0</double>
+ <double>1.1234</double>
+ <double>-1.1234</double>
+
+ <decimal>0</decimal>
+ <decimal>1.1234</decimal>
+ <decimal>-1.1234</decimal>
+
+ <string>string space newline</string>
+
+ <normalized-string>string space newline</normalized-string>
+
+ <token> string space newline</token>
+
+ <name>as123:345-.abs</name>
+
+ <nmtoken>1as123:345-.abs</nmtoken>
+
+ <nmtokens>abc 123</nmtokens>
+
+ <ncname>as123_345-.abs</ncname>
+
+ <id>abc</id>
+ <id>a123</id>
+
+ <idref>abc</idref>
+
+ <idrefs>abc a123</idrefs>
+
+ <language>en</language>
+ <language>en-us</language>
+
+ <uri>http://www.example.com/foo#bar</uri>
+
+ <qname>schemaLocation</qname>
+ <qname>xsi:schemaLocation</qname>
+
+ <base64_binary>MTIzNDVhYmNqaw==</base64_binary>
+ <base64_binary>YQ==</base64_binary>
+ <base64_binary>YWI=</base64_binary>
+ <base64_binary>YWJj</base64_binary>
+
+ <hex_binary></hex_binary>
+ <hex_binary>31323334356162636a6b</hex_binary>
+
+ <gday>---12+12:00</gday>
+ <gday>---01</gday>
+ <gday>---31</gday>
+ <gday>---15Z</gday>
+ <gday>---15-14:00</gday>
+
+ <gmonth>--10+12:00</gmonth>
+ <gmonth>--01</gmonth>
+ <gmonth>--12Z</gmonth>
+
+ <gyear>2007+12:00</gyear>
+ <gyear>0001</gyear>
+ <gyear>-20000Z</gyear>
+
+ <gmonth_day>--10-28+12:00</gmonth_day>
+ <gmonth_day>--12-31</gmonth_day>
+ <gmonth_day>--01-01Z</gmonth_day>
+
+ <gyear_month>2007-12+12:00</gyear_month>
+ <gyear_month>-2007-10</gyear_month>
+ <gyear_month>20007-10Z</gyear_month>
+ <gyear_month>-20007-01</gyear_month>
+
+ <date>2007-12-26+12:00</date>
+ <date>-2007-10-15</date>
+ <date>20007-12-31Z</date>
+ <date>-20007-01-01</date>
+
+ <time>12:46:23.456+12:00</time>
+ <time>12:13:14</time>
+ <time>12:13:14Z</time>
+
+ <date_time>2007-12-26T12:13:14.123+12:00</date_time>
+ <date_time>-2007-10-15T12:13:14</date_time>
+ <date_time>20007-12-31T12:13:14Z</date_time>
+ <date_time>-20007-01-01T12:13:14</date_time>
+
+ <duration>-P2007Y13M32DT25H61M61.123S</duration>
+ <duration>P1Y</duration>
+ <duration>P1M</duration>
+ <duration>P1D</duration>
+ <duration>PT1H</duration>
+ <duration>PT1M</duration>
+ <duration>PT1.1S</duration>
+ <duration>P1YT1S</duration>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/generated-impl/test.xsd b/xsd-tests/cxx/parser/generated-impl/test.xsd
new file mode 100644
index 0000000..7bc8f23
--- /dev/null
+++ b/xsd-tests/cxx/parser/generated-impl/test.xsd
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- enum -->
+
+ <simpleType name="gender">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="gender-extension">
+ <simpleContent>
+ <extension base="t:gender">
+ <attribute name="foo" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <!-- list -->
+
+ <simpleType name="list">
+ <list itemType="int"/>
+ </simpleType>
+
+ <complexType name="list-extension">
+ <simpleContent>
+ <extension base="t:list">
+ <attribute name="foo" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <!-- union -->
+
+ <simpleType name="union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <complexType name="union-extension">
+ <simpleContent>
+ <extension base="t:union">
+ <attribute name="foo" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <!-- complex -->
+
+ <complexType name="complex">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="x" type="string"/>
+ </complexType>
+
+ <complexType name="complex-extension">
+ <complexContent>
+ <extension base="t:complex">
+ <sequence>
+ <element name="b" type="string"/>
+ </sequence>
+ <attribute name="y" type="string"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="gender" type="t:gender"/>
+ <element name="gender-extension" type="t:gender-extension"/>
+
+ <element name="list" type="t:list"/>
+ <element name="list-extension" type="t:list-extension"/>
+
+ <element name="union" type="t:union"/>
+ <element name="union-extension" type="t:union-extension"/>
+
+ <element name="complex" type="t:complex"/>
+ <element name="complex-extension" type="t:complex-extension"/>
+
+ <!-- Built-in types. -->
+
+ <element name="any-type" type="anyType" maxOccurs="unbounded"/>
+ <element name="any-simple-type" type="anySimpleType" maxOccurs="unbounded"/>
+
+ <element name="boolean" type="boolean" maxOccurs="unbounded"/>
+
+ <element name="byte" type="byte" maxOccurs="unbounded"/>
+ <element name="unsigned-byte" type="unsignedByte" maxOccurs="unbounded"/>
+ <element name="short" type="short" maxOccurs="unbounded"/>
+ <element name="unsigned-short" type="unsignedShort" maxOccurs="unbounded"/>
+ <element name="int" type="int" maxOccurs="unbounded"/>
+ <element name="unsigned-int" type="unsignedInt" maxOccurs="unbounded"/>
+ <element name="long" type="long" maxOccurs="unbounded"/>
+ <element name="unsigned-long" type="unsignedLong" maxOccurs="unbounded"/>
+
+ <element name="integer" type="integer" maxOccurs="unbounded"/>
+ <element name="negative-integer" type="negativeInteger" maxOccurs="unbounded"/>
+ <element name="non-positive-integer" type="nonPositiveInteger" maxOccurs="unbounded"/>
+ <element name="positive-integer" type="positiveInteger" maxOccurs="unbounded"/>
+ <element name="non-negative-integer" type="nonNegativeInteger" maxOccurs="unbounded"/>
+
+ <element name="float" type="float" maxOccurs="unbounded"/>
+ <element name="double" type="double" maxOccurs="unbounded"/>
+ <element name="decimal" type="decimal" maxOccurs="unbounded"/>
+
+ <element name="string" type="string" maxOccurs="unbounded"/>
+ <element name="normalized-string" type="normalizedString" maxOccurs="unbounded"/>
+ <element name="token" type="token" maxOccurs="unbounded"/>
+ <element name="name" type="Name" maxOccurs="unbounded"/>
+ <element name="nmtoken" type="NMTOKEN" maxOccurs="unbounded"/>
+ <element name="nmtokens" type="NMTOKENS" maxOccurs="unbounded"/>
+ <element name="ncname" type="NCName" maxOccurs="unbounded"/>
+ <element name="id" type="ID" maxOccurs="unbounded"/>
+ <element name="idref" type="IDREF" maxOccurs="unbounded"/>
+ <element name="idrefs" type="IDREFS" maxOccurs="unbounded"/>
+
+ <element name="language" type="language" maxOccurs="unbounded"/>
+ <element name="uri" type="anyURI" maxOccurs="unbounded"/>
+ <element name="qname" type="QName" maxOccurs="unbounded"/>
+
+ <element name="base64_binary" type="base64Binary" maxOccurs="unbounded"/>
+ <element name="hex_binary" type="hexBinary" maxOccurs="unbounded"/>
+
+ <element name="gday" type="gDay" maxOccurs="unbounded"/>
+ <element name="gmonth" type="gMonth" maxOccurs="unbounded"/>
+ <element name="gyear" type="gYear" maxOccurs="unbounded"/>
+ <element name="gmonth_day" type="gMonthDay" maxOccurs="unbounded"/>
+ <element name="gyear_month" type="gYearMonth" maxOccurs="unbounded"/>
+ <element name="date" type="date" maxOccurs="unbounded"/>
+ <element name="time" type="time" maxOccurs="unbounded"/>
+ <element name="date_time" type="dateTime" maxOccurs="unbounded"/>
+ <element name="duration" type="duration" maxOccurs="unbounded"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/list/buildfile b/xsd-tests/cxx/parser/list/buildfile
new file mode 100644
index 0000000..426101e
--- /dev/null
+++ b/xsd-tests/cxx/parser/list/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/parser/list/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/list/driver.cxx b/xsd-tests/cxx/parser/list/driver.cxx
new file mode 100644
index 0000000..382da5b
--- /dev/null
+++ b/xsd-tests/cxx/parser/list/driver.cxx
@@ -0,0 +1,105 @@
+// file : cxx/parser/list/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test xsd:list parsing.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct string_list_pimpl: string_list_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ item (string const& v)
+ {
+ cout << " '" << v << "'" << endl;
+ }
+
+ virtual void
+ post_string_list ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct string_list_lang_pimpl: string_list_lang_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ item (string const& v)
+ {
+ cout << " '" << v << "'" << endl;
+ }
+
+ virtual void
+ lang (string const& v)
+ {
+ cout << " lang: '" << v << "'" << endl;
+ }
+
+ virtual void
+ post_string_list_lang ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ string_list_pimpl string_list_p;
+ string_list_lang_pimpl string_list_lang_p;
+ type_pimpl type_p;
+
+ string_list_p.parsers (string_p);
+ string_list_lang_p.parsers (string_p, string_p);
+ type_p.parsers (string_list_p, string_list_lang_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ type_p.pre ();
+ doc_p.parse (argv[1]);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/list/output b/xsd-tests/cxx/parser/list/output
new file mode 100644
index 0000000..3642c4d
--- /dev/null
+++ b/xsd-tests/cxx/parser/list/output
@@ -0,0 +1,26 @@
+{
+}
+
+{
+}
+
+{
+}
+
+{
+ 'one'
+}
+
+{
+ 'one'
+ 'two'
+ 'three'
+}
+
+{
+ lang: 'en'
+ 'one'
+ 'two'
+ 'three'
+}
+
diff --git a/xsd-tests/cxx/parser/list/test.xml b/xsd-tests/cxx/parser/list/test.xml
new file mode 100644
index 0000000..52229db
--- /dev/null
+++ b/xsd-tests/cxx/parser/list/test.xml
@@ -0,0 +1,25 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <string-list/>
+
+ <string-list> </string-list>
+
+ <string-list>
+
+ </string-list>
+
+ <string-list>one</string-list>
+
+ <string-list>
+ one two
+ three
+ </string-list>
+
+ <string-list-lang lang="en">
+ one two
+ three
+ </string-list-lang>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/list/test.xsd b/xsd-tests/cxx/parser/list/test.xsd
new file mode 100644
index 0000000..79bd084
--- /dev/null
+++ b/xsd-tests/cxx/parser/list/test.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="string-list">
+ <list itemType="string"/>
+ </simpleType>
+
+ <complexType name="string-list-lang">
+ <simpleContent>
+ <extension base="t:string-list">
+ <attribute name="lang" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="type">
+ <choice maxOccurs="unbounded">
+ <element name="string-list" type="t:string-list"/>
+ <element name="string-list-lang" type="t:string-list-lang"/>
+ </choice>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/name-clash/inheritance/buildfile b/xsd-tests/cxx/parser/name-clash/inheritance/buildfile
new file mode 100644
index 0000000..4bd7b48
--- /dev/null
+++ b/xsd-tests/cxx/parser/name-clash/inheritance/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/name-clash/inheritance/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/name-clash/inheritance/driver.cxx b/xsd-tests/cxx/parser/name-clash/inheritance/driver.cxx
new file mode 100644
index 0000000..9e9b905
--- /dev/null
+++ b/xsd-tests/cxx/parser/name-clash/inheritance/driver.cxx
@@ -0,0 +1,62 @@
+// file : cxx/parser/name-clash/inheritance/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test for name clashes across inheritance hierarchy.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct derived_pimpl: derived_pskel
+{
+ virtual void
+ e (string const& v)
+ {
+ cout << "e: " << v << endl;
+ }
+
+ virtual void
+ e1 (string const& v)
+ {
+ cout << "e1: " << v << endl;
+ }
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ derived_pimpl derived_p;
+
+ derived_p.parsers (string_p, string_p);
+
+ xml_schema::document doc_p (derived_p, "test", "root");
+
+ derived_p.pre ();
+ doc_p.parse (argv[1]);
+ derived_p.post_derived ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/name-clash/inheritance/output b/xsd-tests/cxx/parser/name-clash/inheritance/output
new file mode 100644
index 0000000..4efd51b
--- /dev/null
+++ b/xsd-tests/cxx/parser/name-clash/inheritance/output
@@ -0,0 +1,2 @@
+e: e
+e1: e1
diff --git a/xsd-tests/cxx/parser/name-clash/inheritance/test.xml b/xsd-tests/cxx/parser/name-clash/inheritance/test.xml
new file mode 100644
index 0000000..8c17101
--- /dev/null
+++ b/xsd-tests/cxx/parser/name-clash/inheritance/test.xml
@@ -0,0 +1,8 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <e>e</e>
+ <e>e1</e>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/name-clash/inheritance/test.xsd b/xsd-tests/cxx/parser/name-clash/inheritance/test.xsd
new file mode 100644
index 0000000..62a782e
--- /dev/null
+++ b/xsd-tests/cxx/parser/name-clash/inheritance/test.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="base">
+ <sequence>
+ <element name="e" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="derived">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="e" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="root" type="t:derived"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/buildfile b/xsd-tests/cxx/parser/polymorphism/recursive/buildfile
new file mode 100644
index 0000000..629645b
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/polymorphism/recursive/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-polymorphic \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/driver.cxx b/xsd-tests/cxx/parser/polymorphism/recursive/driver.cxx
new file mode 100644
index 0000000..26793a0
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/driver.cxx
@@ -0,0 +1,68 @@
+// file : cxx/parser/polymorphism/recursive/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test polymorphic recursive parsing.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+#include "test-pimpl.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::int_pimpl int_p;
+
+ root_pimpl root_p;
+ expression_pimpl expression_p;
+ recursive_pimpl recursive_p;
+ value_a_pimpl value_a_p;
+ value_b_pimpl value_b_p;
+
+ xml_schema::parser_map_impl expression_map;
+
+ // Connect the parsers together.
+ //
+ root_p.parsers (expression_p);
+ expression_map.insert(value_a_p);
+ expression_map.insert(value_b_p);
+ expression_map.insert(recursive_p);
+
+ root_p.expression_parser(expression_map);
+
+ recursive_p.parsers(expression_p);
+ recursive_p.expression_parser(expression_map);
+
+ value_a_p.parsers(int_p);
+ value_b_p.parsers(int_p);
+
+ xml_schema::document doc_p (root_p, "test", "root", true);
+
+ root_p.pre ();
+ doc_p.parse (argv[1]);
+ root_p.post_root ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/output b/xsd-tests/cxx/parser/polymorphism/recursive/output
new file mode 100644
index 0000000..28a835f
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/output
@@ -0,0 +1,22 @@
+root start
+recursive start
+value_a begin
+value->constant
+value: post_expression override
+value_a: post_value override
+value_a end
+recursive->expression event
+recursive start
+value_b begin
+value->constant
+value: post_expression override
+value_b: post_value override
+value_b end
+recursive->expression event
+recursive: post_expression override
+recursive end
+recursive->expression event
+recursive: post_expression override
+recursive end
+root->expression
+root end
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.cxx b/xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.cxx
new file mode 100644
index 0000000..7c7f410
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.cxx
@@ -0,0 +1,147 @@
+// file : cxx/parser/polymorphism/recursive/pimpl.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <iostream>
+
+#include "test-pimpl.hxx"
+
+using namespace std;
+
+namespace test
+{
+ // root_pimpl
+ //
+
+ void root_pimpl::
+ pre ()
+ {
+ cout << "root start" << endl;
+ }
+
+ void root_pimpl::
+ expression ()
+ {
+ cout << "root->expression" << endl;
+ }
+
+ void root_pimpl::
+ post_root ()
+ {
+ cout << "root end" << endl;
+ }
+
+ // expression_pimpl
+ //
+
+ void expression_pimpl::
+ pre ()
+ {
+ cout << "expression begin" << endl;
+ }
+
+ void expression_pimpl::
+ post_expression ()
+ {
+ cout << "expression end" << endl;
+ }
+
+ // recursive_pimpl
+ //
+
+ void recursive_pimpl::
+ pre ()
+ {
+ cout << "recursive start" << endl;
+ }
+
+ void recursive_pimpl::
+ expression ()
+ {
+ cout << "recursive->expression event" << endl;
+ }
+
+ void recursive_pimpl::
+ post_expression ()
+ {
+ cout << "recursive: post_expression override" << endl;
+ post_recursive ();
+ }
+
+ void recursive_pimpl::
+ post_recursive ()
+ {
+ cout << "recursive end" << endl;
+ }
+
+ // value_pimpl
+ //
+
+ void value_pimpl::
+ pre ()
+ {
+ cout << "value begin" << endl;
+ }
+
+ void value_pimpl::
+ constant (int)
+ {
+ cout << "value->constant" << endl;
+ }
+
+ void value_pimpl::
+ post_expression ()
+ {
+ cout << "value: post_expression override" << endl;
+ post_value ();
+ }
+
+ void value_pimpl::
+ post_value ()
+ {
+ cout << "value end" << endl;
+ }
+
+ // value_a_pimpl
+ //
+
+ void value_a_pimpl::
+ pre ()
+ {
+ cout << "value_a begin" << endl;
+ }
+
+ void value_a_pimpl::
+ post_value ()
+ {
+ cout << "value_a: post_value override" << endl;
+ post_value_a ();
+ }
+
+ void value_a_pimpl::
+ post_value_a ()
+ {
+ cout << "value_a end" << endl;
+ }
+
+ // value_b_pimpl
+ //
+
+ void value_b_pimpl::
+ pre ()
+ {
+ cout << "value_b begin" << endl;
+ }
+
+ void value_b_pimpl::
+ post_value ()
+ {
+ cout << "value_b: post_value override" << endl;
+ post_value_b ();
+ }
+
+ void value_b_pimpl::
+ post_value_b ()
+ {
+ cout << "value_b end" << endl;
+ }
+}
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.hxx b/xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.hxx
new file mode 100644
index 0000000..928b880
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/test-pimpl.hxx
@@ -0,0 +1,94 @@
+// file : cxx/parser/polymorphism/recursive/pimpl.hxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef TEST_PIMPL_HXX
+#define TEST_PIMPL_HXX
+
+#include "test-pskel.hxx"
+
+namespace test
+{
+ class root_pimpl: public virtual root_pskel
+ {
+ public:
+ virtual void
+ pre ();
+
+ virtual void
+ expression ();
+
+ virtual void
+ post_root ();
+ };
+
+ class expression_pimpl: public virtual expression_pskel
+ {
+ public:
+ virtual void
+ pre ();
+
+ virtual void
+ post_expression ();
+ };
+
+ class recursive_pimpl: public virtual recursive_pskel,
+ public expression_pimpl
+ {
+ public:
+ virtual void
+ pre ();
+
+ virtual void
+ expression ();
+
+ virtual void
+ post_expression ();
+
+ virtual void
+ post_recursive ();
+ };
+
+ class value_pimpl: public virtual value_pskel, public expression_pimpl
+ {
+ public:
+ virtual void
+ pre ();
+
+ virtual void
+ constant (int);
+
+ virtual void
+ post_expression ();
+
+ virtual void
+ post_value ();
+ };
+
+ class value_a_pimpl: public virtual value_a_pskel, public value_pimpl
+ {
+ public:
+ virtual void
+ pre ();
+
+ virtual void
+ post_value ();
+
+ virtual void
+ post_value_a ();
+ };
+
+ class value_b_pimpl: public virtual value_b_pskel, public value_pimpl
+ {
+ public:
+ virtual void
+ pre ();
+
+ virtual void
+ post_value ();
+
+ virtual void
+ post_value_b ();
+ };
+}
+
+#endif // TEST_PIMPL_HXX
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/test.xml b/xsd-tests/cxx/parser/polymorphism/recursive/test.xml
new file mode 100644
index 0000000..42035ba
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/test.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root xmlns="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+ <recursive>
+ <value-a>
+ <constant>1</constant>
+ </value-a>
+ <recursive>
+ <value-b>
+ <constant>2</constant>
+ </value-b>
+ </recursive>
+ </recursive>
+</root>
diff --git a/xsd-tests/cxx/parser/polymorphism/recursive/test.xsd b/xsd-tests/cxx/parser/polymorphism/recursive/test.xsd
new file mode 100644
index 0000000..affcc8a
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/recursive/test.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:t="test"
+ targetNamespace="test"
+ elementFormDefault="qualified">
+
+ <element name="root" type="t:root"/>
+ <complexType name="root">
+ <sequence>
+ <element ref="t:expression" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="expression" type="t:expression" abstract="true"/>
+ <complexType name="expression" abstract="true"/>
+
+ <element name="recursive" type="t:recursive" substitutionGroup="t:expression"/>
+ <complexType name="recursive">
+ <complexContent>
+ <extension base="t:expression">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="t:expression"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="value" type="t:value" abstract="true" substitutionGroup="t:expression"/>
+ <complexType name="value" abstract="true">
+ <complexContent>
+ <extension base="t:expression">
+ <sequence>
+ <element name="constant" type="int"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="value-a" type="t:value-a" substitutionGroup="t:expression"/>
+ <complexType name="value-a">
+ <complexContent>
+ <extension base="t:value"/>
+ </complexContent>
+ </complexType>
+
+ <element name="value-b" type="t:value-b" substitutionGroup="t:expression"/>
+ <complexType name="value-b">
+ <complexContent>
+ <extension base="t:value"/>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/polymorphism/same-type/buildfile b/xsd-tests/cxx/parser/polymorphism/same-type/buildfile
new file mode 100644
index 0000000..d98e917
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/same-type/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/polymorphism/same-type/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-polymorphic \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/polymorphism/same-type/driver.cxx b/xsd-tests/cxx/parser/polymorphism/same-type/driver.cxx
new file mode 100644
index 0000000..6da4a0a
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/same-type/driver.cxx
@@ -0,0 +1,62 @@
+// file : cxx/parser/polymorphism/same-type/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test substitution group and xsi:type that don't change the type.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct base_pimpl: base_pskel
+{
+ virtual void
+ a (string const& v)
+ {
+ cout << v << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ base_pimpl base_p;
+ type_pimpl type_p;
+
+ base_p.parsers (string_p);
+ type_p.parsers (base_p);
+
+ xml_schema::document doc_p (type_p, "test", "root", true);
+
+ type_p.pre ();
+ doc_p.parse (argv[1]);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/polymorphism/same-type/output b/xsd-tests/cxx/parser/polymorphism/same-type/output
new file mode 100644
index 0000000..d418277
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/same-type/output
@@ -0,0 +1,4 @@
+a1
+a2
+a3
+a4
diff --git a/xsd-tests/cxx/parser/polymorphism/same-type/test.xml b/xsd-tests/cxx/parser/polymorphism/same-type/test.xml
new file mode 100644
index 0000000..f8b6d1e
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/same-type/test.xml
@@ -0,0 +1,10 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <t:base><a>a1</a></t:base>
+ <t:derived><a>a2</a></t:derived>
+ <t:base xsi:type="t:base"><a>a3</a></t:base>
+ <t:derived xsi:type="t:base"><a>a4</a></t:derived>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/polymorphism/same-type/test.xsd b/xsd-tests/cxx/parser/polymorphism/same-type/test.xsd
new file mode 100644
index 0000000..a4157d3
--- /dev/null
+++ b/xsd-tests/cxx/parser/polymorphism/same-type/test.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="base" type="t:base"/>
+ <element name="derived" type="t:base" substitutionGroup="t:base"/>
+
+ <complexType name="type">
+ <sequence>
+ <element ref="t:base" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/recursive/buildfile b/xsd-tests/cxx/parser/recursive/buildfile
new file mode 100644
index 0000000..237855c
--- /dev/null
+++ b/xsd-tests/cxx/parser/recursive/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/recursive/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/recursive/driver.cxx b/xsd-tests/cxx/parser/recursive/driver.cxx
new file mode 100644
index 0000000..c93fd35
--- /dev/null
+++ b/xsd-tests/cxx/parser/recursive/driver.cxx
@@ -0,0 +1,139 @@
+// file : cxx/parser/recursive/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test recursive parser invocation.
+//
+
+#include <iostream>
+#include <string>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+
+struct sub_pimpl: sub_type_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "sub::pre" << endl;
+ }
+
+ virtual void
+ sub ()
+ {
+ cout << "sub::sub" << endl;
+ }
+
+ virtual void
+ sub2 ()
+ {
+ cout << "sub::sub2" << endl;
+ }
+
+ virtual void
+ name (string const& n)
+ {
+ cout << "sub::name: " << n << endl;
+ }
+
+ virtual void
+ post_sub_type ()
+ {
+ cout << "sub::post" << endl;
+ }
+};
+
+struct indir_pimpl: indir_type_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "indir::pre" << endl;
+ }
+
+ virtual void
+ sub ()
+ {
+ cout << "indir::sub" << endl;
+ }
+
+ virtual void
+ name (string const& n)
+ {
+ cout << "indir::name: " << n << endl;
+ }
+
+ virtual void
+ post_indir_type ()
+ {
+ cout << "indir::post" << endl;
+ }
+};
+
+struct test_pimpl: test_type_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "test::pre" << endl;
+ }
+
+ virtual void
+ sub ()
+ {
+ cout << "test::sub" << endl;
+ }
+
+ virtual void
+ name (string const& n)
+ {
+ cout << "test::name: " << n << endl;
+ }
+
+ virtual void
+ post_test_type ()
+ {
+ cout << "test::post" << endl;
+ }
+};
+
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+
+ sub_pimpl sub_p;
+ indir_pimpl indir_p;
+ test_pimpl test_p;
+
+ sub_p.parsers (sub_p, indir_p, sub_p, string_p);
+ indir_p.parsers (sub_p, string_p);
+ test_p.parsers (sub_p, string_p);
+
+ xml_schema::document doc_p (test_p, "test");
+
+ test_p.pre ();
+ doc_p.parse (argv[1]);
+ test_p.post_test_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/recursive/output b/xsd-tests/cxx/parser/recursive/output
new file mode 100644
index 0000000..f26fb72
--- /dev/null
+++ b/xsd-tests/cxx/parser/recursive/output
@@ -0,0 +1,22 @@
+test::pre
+test::name: testName
+sub::pre
+sub::name: subName
+sub::pre
+sub::name: sub-subName
+sub::post
+sub::sub
+indir::pre
+indir::name: sub-indirName
+sub::pre
+sub::name: sub-indir-subName
+sub::post
+indir::sub
+indir::post
+sub::pre
+sub::name: sub-sub2Name
+sub::post
+sub::sub2
+sub::post
+test::sub
+test::post
diff --git a/xsd-tests/cxx/parser/recursive/test.xml b/xsd-tests/cxx/parser/recursive/test.xml
new file mode 100644
index 0000000..f6c219d
--- /dev/null
+++ b/xsd-tests/cxx/parser/recursive/test.xml
@@ -0,0 +1,11 @@
+<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="test.xsd"
+ name="testName">
+ <sub name="subName">
+ <sub name="sub-subName"/>
+ <indir name="sub-indirName">
+ <sub name="sub-indir-subName"/>
+ </indir>
+ <sub2 name="sub-sub2Name"/>
+ </sub>
+</test>
diff --git a/xsd-tests/cxx/parser/recursive/test.xsd b/xsd-tests/cxx/parser/recursive/test.xsd
new file mode 100644
index 0000000..33e1d2d
--- /dev/null
+++ b/xsd-tests/cxx/parser/recursive/test.xsd
@@ -0,0 +1,27 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:complexType name="sub_type">
+ <xs:sequence>
+ <xs:element name="sub" type="sub_type" minOccurs="0"/>
+ <xs:element name="indir" type="indir_type" minOccurs="0"/>
+ <xs:element name="sub2" type="sub_type" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+
+ <xs:complexType name="indir_type">
+ <xs:sequence>
+ <xs:element name="sub" type="sub_type" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+
+ <xs:complexType name="test_type">
+ <xs:sequence>
+ <xs:element name="sub" type="sub_type" />
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+
+ <xs:element name="test" type="test_type" />
+</xs:schema>
diff --git a/xsd-tests/cxx/parser/test-template/buildfile b/xsd-tests/cxx/parser/test-template/buildfile
new file mode 100644
index 0000000..9f7f5d3
--- /dev/null
+++ b/xsd-tests/cxx/parser/test-template/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/parser/test-template/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/test-template/driver.cxx b/xsd-tests/cxx/parser/test-template/driver.cxx
new file mode 100644
index 0000000..333c6fd
--- /dev/null
+++ b/xsd-tests/cxx/parser/test-template/driver.cxx
@@ -0,0 +1,66 @@
+// file : cxx/parser/test-template/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Insert test description here.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct type_pimpl: type_pskel
+{
+ virtual void
+ pre ()
+ {
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << v << endl;
+ }
+
+ virtual void
+ post_type ()
+ {
+ }
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ type_pimpl type_p;
+
+ type_p.parsers (string_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ type_p.pre ();
+ doc_p.parse (argv[1]);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/test-template/output b/xsd-tests/cxx/parser/test-template/output
new file mode 100644
index 0000000..7898192
--- /dev/null
+++ b/xsd-tests/cxx/parser/test-template/output
@@ -0,0 +1 @@
+a
diff --git a/xsd-tests/cxx/parser/test-template/test.xml b/xsd-tests/cxx/parser/test-template/test.xml
new file mode 100644
index 0000000..624a80c
--- /dev/null
+++ b/xsd-tests/cxx/parser/test-template/test.xml
@@ -0,0 +1,7 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>a</a>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/test-template/test.xsd b/xsd-tests/cxx/parser/test-template/test.xsd
new file mode 100644
index 0000000..07bebc7
--- /dev/null
+++ b/xsd-tests/cxx/parser/test-template/test.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/union/buildfile b/xsd-tests/cxx/parser/union/buildfile
new file mode 100644
index 0000000..1a8615c
--- /dev/null
+++ b/xsd-tests/cxx/parser/union/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/parser/union/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/union/driver.cxx b/xsd-tests/cxx/parser/union/driver.cxx
new file mode 100644
index 0000000..c5b5c71
--- /dev/null
+++ b/xsd-tests/cxx/parser/union/driver.cxx
@@ -0,0 +1,60 @@
+// file : cxx/parser/union/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test xsd:union parsing.
+//
+
+#include <string>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct int_string_union_pimpl: int_string_union_pskel
+{
+ virtual void
+ _characters (const xml_schema::ro_string& s)
+ {
+ cout << "'" << s << "'" << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ int_string_union_pimpl int_string_union_p;
+ type_pimpl type_p;
+
+ type_p.parsers (int_string_union_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ type_p.pre ();
+ doc_p.parse (argv[1]);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (std::ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/union/output b/xsd-tests/cxx/parser/union/output
new file mode 100644
index 0000000..a92ffc3
--- /dev/null
+++ b/xsd-tests/cxx/parser/union/output
@@ -0,0 +1,2 @@
+'one'
+'1'
diff --git a/xsd-tests/cxx/parser/union/test.xml b/xsd-tests/cxx/parser/union/test.xml
new file mode 100644
index 0000000..5b3e799
--- /dev/null
+++ b/xsd-tests/cxx/parser/union/test.xml
@@ -0,0 +1,10 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <int-string-union/>
+ <int-string-union> </int-string-union>
+ <int-string-union>one</int-string-union>
+ <int-string-union>1</int-string-union>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/union/test.xsd b/xsd-tests/cxx/parser/union/test.xsd
new file mode 100644
index 0000000..5bf3d47
--- /dev/null
+++ b/xsd-tests/cxx/parser/union/test.xsd
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="int-string-union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <complexType name="type">
+ <choice maxOccurs="unbounded">
+ <element name="int-string-union" type="t:int-string-union"/>
+ </choice>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/all/buildfile b/xsd-tests/cxx/parser/validation/all/buildfile
new file mode 100644
index 0000000..555843e
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/all/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/parser/validation/all/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs \
+ testscript
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/all/driver.cxx b/xsd-tests/cxx/parser/validation/all/driver.cxx
new file mode 100644
index 0000000..a8cbcca
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/all/driver.cxx
@@ -0,0 +1,98 @@
+// file : cxx/parser/validation/all/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the all compositor validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct all_pimpl: all_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ b (string const& v)
+ {
+ cout << " b = " << v << endl;
+ }
+
+ virtual void
+ c (string const& v)
+ {
+ cout << " c = " << v << endl;
+ }
+
+ virtual void
+ post_all ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ all_pimpl all_p;
+ type_pimpl type_p;
+
+ all_p.parsers (string_p, string_p, string_p);
+ type_p.parsers (all_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ try
+ {
+ ifstream ifs (argv[1]);
+ type_p.pre ();
+ doc_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cout << " " << e << endl
+ << "}" << endl
+ << endl;
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/all/test.xsd b/xsd-tests/cxx/parser/validation/all/test.xsd
new file mode 100644
index 0000000..1f670e3
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/all/test.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="all">
+ <all minOccurs="1">
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ <element name="c" type="string" minOccurs="0"/>
+ </all>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="all" type="t:all" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/all/testscript b/xsd-tests/cxx/parser/validation/all/testscript
new file mode 100644
index 0000000..e93e59c
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/all/testscript
@@ -0,0 +1,190 @@
+# file : cxx/parser/validation/all/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+test.arguments += test.xml
+
+: all-combinations
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- all combinations -->
+ <all>
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ </all>
+
+ <all>
+ <a>a</a>
+ <c>c</c>
+ <b>b</b>
+ </all>
+
+ <all>
+ <b>b</b>
+ <a>a</a>
+ <c>c</c>
+ </all>
+
+ <all>
+ <b>b</b>
+ <c>c</c>
+ <a>a</a>
+ </all>
+
+ <all>
+ <c>c</c>
+ <a>a</a>
+ <b>b</b>
+ </all>
+
+ <all>
+ <c>c</c>
+ <b>b</b>
+ <a>a</a>
+ </all>
+
+ <!-- optional c is not present -->
+ <all>
+ <a>a</a>
+ <b>b</b>
+ </all>
+
+ <all>
+ <a>a</a>
+ <b>b</b>
+ </all>
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ a = a
+ b = b
+ c = c
+ }
+
+ {
+ a = a
+ c = c
+ b = b
+ }
+
+ {
+ b = b
+ a = a
+ c = c
+ }
+
+ {
+ b = b
+ c = c
+ a = a
+ }
+
+ {
+ c = c
+ a = a
+ b = b
+ }
+
+ {
+ c = c
+ b = b
+ a = a
+ }
+
+ {
+ a = a
+ b = b
+ }
+
+ {
+ a = a
+ b = b
+ }
+
+ EOO
+}
+
+: required-not-present
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- required b is not present (invalid) -->
+ <all>
+ <a>a</a>
+ <c>c</c>
+ </all>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ a = a
+ c = c
+ :9:9 error: expected element 'b'
+ }
+
+ EOO
+}
+
+: absent
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- invalid -->
+ <all>
+ </all>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ :7:9 error: expected element 'a'
+ }
+
+ EOO
+}
+
+: unexpected
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- invalid -->
+ <all>
+ <a>a</a>
+ <b>b</b>
+ <a>a</a>
+ </all>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ a = a
+ b = b
+ :9:7 error: unexpected element 'a'
+ }
+
+ EOO
+}
diff --git a/xsd-tests/cxx/parser/validation/any/buildfile b/xsd-tests/cxx/parser/validation/any/buildfile
new file mode 100644
index 0000000..57135f4
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/any/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/validation/any/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/any/driver.cxx b/xsd-tests/cxx/parser/validation/any/driver.cxx
new file mode 100644
index 0000000..1eceda6
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/any/driver.cxx
@@ -0,0 +1,121 @@
+// file : cxx/parser/validation/any/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the any particle validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+using xml_schema::ro_string;
+
+struct any_a_pimpl: any_a_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ x (string const& v)
+ {
+ cout << " x = " << v << endl;
+ }
+
+ virtual void
+ _start_any_element (ro_string const&,
+ ro_string const& n,
+ ro_string const*)
+ {
+ cout << " start any element '" << n << "'" << endl;
+ }
+
+ virtual void
+ _end_any_element (ro_string const&, ro_string const& n)
+ {
+ cout << " end any element '" << n << "'" << endl;
+ }
+
+ virtual void
+ _any_attribute (ro_string const&,
+ ro_string const& n,
+ ro_string const& v)
+ {
+ cout << " any attribute " << n << " = '" << v << "'" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& s)
+ {
+ cout << " any text: '" << s << "'" << endl;
+ }
+
+ virtual void
+ post_any_a ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ any_a_pimpl any_a_p;
+ type_pimpl type_p;
+
+ any_a_p.parsers (string_p, string_p);
+ type_p.parsers (any_a_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ try
+ {
+ ifstream ifs (argv[1]);
+ type_p.pre ();
+ doc_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cout << " " << e << endl
+ << "}" << endl
+ << endl;
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/any/output b/xsd-tests/cxx/parser/validation/any/output
new file mode 100644
index 0000000..a1cc6e3
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/any/output
@@ -0,0 +1,29 @@
+{
+ start any element 'any'
+ end any element 'any'
+}
+
+{
+ start any element 'any'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any'
+}
+
+{
+ x = x
+ a = a
+ start any element 'any'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any'
+}
+
diff --git a/xsd-tests/cxx/parser/validation/any/test.xml b/xsd-tests/cxx/parser/validation/any/test.xml
new file mode 100644
index 0000000..f1a0c83
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/any/test.xml
@@ -0,0 +1,21 @@
+<t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- test dispatching of any-nested elements and attributes -->
+
+ <any-a>
+ <o:any/>
+ </any-a>
+
+ <any-a>
+ <o:any x="xxx">aaa<a>bbb</a>ccc</o:any>
+ </any-a>
+
+ <any-a x="x">
+ <a>a</a>
+ <o:any x="xxx">aaa<a>bbb</a>ccc</o:any>
+ </any-a>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/validation/any/test.xsd b/xsd-tests/cxx/parser/validation/any/test.xsd
new file mode 100644
index 0000000..c05aeb5
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/any/test.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="any-a">
+ <sequence>
+ <element name="a" type="string" minOccurs="0"/>
+ <any namespace="other" processContents="skip" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="x" type="string"/>
+ </complexType>
+
+ <complexType name="type">
+ <choice maxOccurs="unbounded">
+ <element name="any-a" type="t:any-a"/>
+ </choice>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/attribute/buildfile b/xsd-tests/cxx/parser/validation/attribute/buildfile
new file mode 100644
index 0000000..d486193
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/attribute/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/validation/attribute/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/attribute/driver.cxx b/xsd-tests/cxx/parser/validation/attribute/driver.cxx
new file mode 100644
index 0000000..4710564
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/attribute/driver.cxx
@@ -0,0 +1,197 @@
+// file : cxx/parser/validation/attribute/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test attribute and attribute wildcard (anyAttribute) validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+using xml_schema::ro_string;
+
+struct pass_a_pimpl: pass_a_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "pass-a" << endl
+ << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ b (string const& v)
+ {
+ cout << " b = " << v << endl;
+ }
+
+ virtual void
+ _any_attribute (ro_string const& ns,
+ ro_string const& name,
+ ro_string const& value)
+ {
+ cout << " any: " << ns << "#" << name << " = " << value << endl;
+ }
+
+ virtual void
+ post_pass_a ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct pass_b_pimpl: pass_b_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "pass-b" << endl
+ << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ b (string const& v)
+ {
+ cout << " b = " << v << endl;
+ }
+
+ virtual void
+ _any_attribute (ro_string const& ns,
+ ro_string const& name,
+ ro_string const& value)
+ {
+ cout << " any: " << ns << "#" << name << " = " << value << endl;
+ }
+
+ virtual void
+ post_pass_b ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct pass_c_pimpl: pass_c_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "pass-c" << endl
+ << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ b (string const& v)
+ {
+ cout << " b = " << v << endl;
+ }
+
+ virtual void
+ post_pass_c ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct fail_pimpl: fail_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "fail" << endl
+ << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ post_fail ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ pass_a_pimpl pass_a_p;
+ pass_b_pimpl pass_b_p;
+ pass_c_pimpl pass_c_p;
+ fail_pimpl fail_p;
+ type_pimpl type_p;
+
+ pass_a_p.parsers (string_p, string_p);
+ pass_b_p.parsers (string_p, string_p);
+ pass_c_p.parsers (string_p, string_p);
+ fail_p.parsers (string_p);
+ type_p.parsers (pass_a_p, pass_b_p, pass_c_p, fail_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ try
+ {
+ ifstream ifs (argv[1]);
+ type_p.pre ();
+ doc_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cout << " " << e << endl
+ << "}" << endl
+ << endl;
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/attribute/output b/xsd-tests/cxx/parser/validation/attribute/output
new file mode 100644
index 0000000..847b054
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/attribute/output
@@ -0,0 +1,24 @@
+pass-a
+{
+ b = b
+ any: test#foo = foo
+ any: test#bar = bar
+}
+
+pass-b
+{
+ a = a
+ b = b
+}
+
+pass-c
+{
+ a = a
+ b = b
+}
+
+fail
+{
+ :8:10 error: expected attribute 'a'
+}
+
diff --git a/xsd-tests/cxx/parser/validation/attribute/test.xml b/xsd-tests/cxx/parser/validation/attribute/test.xml
new file mode 100644
index 0000000..b994d1a
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/attribute/test.xml
@@ -0,0 +1,10 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <pass-a b="b" t:foo="foo" t:bar="bar"/>
+ <pass-b a="a" b="b"/>
+ <pass-c a="a" b="b"/>
+ <fail/>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/validation/attribute/test.xsd b/xsd-tests/cxx/parser/validation/attribute/test.xsd
new file mode 100644
index 0000000..833eb8e
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/attribute/test.xsd
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+
+ <!-- Test optional and required attributes as well as a wildcard. -->
+ <complexType name="pass-a">
+ <attribute name="a" type="string" use="optional"/>
+ <attribute name="b" type="string" use="required"/>
+ <anyAttribute namespace="##targetNamespace" processContents="skip"/>
+ </complexType>
+
+
+ <!-- Test that in inheritance attributes are checked before wildcards. -->
+ <complexType name="pass-b-base">
+ <attribute name="a" type="string"/>
+ <anyAttribute namespace="#any" processContents="skip"/>
+ </complexType>
+
+ <complexType name="pass-b">
+ <complexContent>
+ <extension base="t:pass-b-base">
+ <attribute name="b" type="string"/>
+ <anyAttribute namespace="#any" processContents="skip"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+
+ <!-- Test that in inheritance by restriction required attribute is
+ checked for even though it is not explicitly mentioned in
+ derived. -->
+ <complexType name="pass-c-base">
+ <attribute name="a" type="string" use="required"/>
+ <attribute name="b" type="string" use="optional"/>
+ </complexType>
+
+ <complexType name="pass-c">
+ <complexContent>
+ <restriction base="t:pass-c-base">
+ <attribute name="b" type="string" use="required"/>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+
+ <!-- Test detection of missing required attribute. -->
+ <complexType name="fail-base">
+ <attribute name="a" type="string" use="optional"/>
+ </complexType>
+
+ <complexType name="fail">
+ <complexContent>
+ <restriction base="t:fail-base">
+ <attribute name="a" type="string" use="required"/>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+
+ <complexType name="type">
+ <sequence>
+ <element name="pass-a" type="t:pass-a"/>
+ <element name="pass-b" type="t:pass-b"/>
+ <element name="pass-c" type="t:pass-c"/>
+ <element name="fail" type="t:fail"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/built-in/any-type/buildfile b/xsd-tests/cxx/parser/validation/built-in/any-type/buildfile
new file mode 100644
index 0000000..a6f366b
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/any-type/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/parser/validation/built-in/any-type/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/built-in/any-type/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/any-type/driver.cxx
new file mode 100644
index 0000000..cbeb864
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/any-type/driver.cxx
@@ -0,0 +1,154 @@
+// file : cxx/parser/validation/built-in/any-type/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the anyType and anySimpleType validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+using xml_schema::ro_string;
+
+struct any_type_pimpl: xml_schema::any_type_pimpl
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ _start_any_element (ro_string const&,
+ ro_string const& n,
+ ro_string const*)
+ {
+ cout << " start any element '" << n << "'" << endl;
+ }
+
+ virtual void
+ _end_any_element (ro_string const&, ro_string const& n)
+ {
+ cout << " end any element '" << n << "'" << endl;
+ }
+
+ virtual void
+ _any_attribute (ro_string const&,
+ ro_string const& n,
+ ro_string const& v)
+ {
+ cout << " any attribute " << n << " = '" << v << "'" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& s)
+ {
+ cout << " any text: '" << s << "'" << endl;
+ }
+
+ virtual void
+ post_any_type ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct any_simple_type_pimpl: xml_schema::any_simple_type_pimpl
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& s)
+ {
+ cout << " any text: '" << s << "'" << endl;
+ }
+
+ virtual void
+ post_any_simple_type ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct any_extension_pimpl: virtual any_extension_pskel,
+ any_type_pimpl
+
+{
+ virtual void
+ x (const string& v)
+ {
+ cout << " x = " << v << endl;
+ }
+};
+
+struct any_simple_extension_pimpl: virtual any_simple_extension_pskel,
+ any_simple_type_pimpl
+{
+ virtual void
+ x (const string& v)
+ {
+ cout << " x = " << v << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+
+ any_type_pimpl any_type_p;
+ any_simple_type_pimpl any_simple_type_p;
+
+ any_extension_pimpl any_extension_p;
+ any_simple_extension_pimpl any_simple_extension_p;
+
+ type_pimpl type_p;
+
+ any_extension_p.parsers (string_p);
+ any_simple_extension_p.parsers (string_p);
+
+ type_p.parsers (any_type_p,
+ any_extension_p,
+ any_simple_extension_p,
+ any_simple_type_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ ifstream ifs (argv[1]);
+ type_p.pre ();
+ doc_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/any-type/output b/xsd-tests/cxx/parser/validation/built-in/any-type/output
new file mode 100644
index 0000000..84d7b3a
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/any-type/output
@@ -0,0 +1,99 @@
+{
+ any text: '123abc'
+}
+
+{
+ any text: '
+ '
+ start any element 'any'
+ end any element 'any'
+ any text: '
+ '
+}
+
+{
+ any text: '
+ '
+ start any element 'any'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any'
+ any text: '
+ '
+}
+
+{
+ any attribute x = 'x'
+ any text: '
+ '
+ start any element 'a'
+ any text: 'a'
+ end any element 'a'
+ any text: '
+ '
+ start any element 'any'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any'
+ any text: '
+ '
+}
+
+{
+ any text: '
+ '
+ start any element 'any'
+ end any element 'any'
+ any text: '
+ '
+}
+
+{
+ any text: '
+ '
+ start any element 'any'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any'
+ any text: '
+ '
+}
+
+{
+ x = x
+ any text: '
+ '
+ start any element 'a'
+ any text: 'a'
+ end any element 'a'
+ any text: '
+ '
+ start any element 'any'
+ any attribute x = 'xxx'
+ any text: 'aaa'
+ start any element 'a'
+ any text: 'bbb'
+ end any element 'a'
+ any text: 'ccc'
+ end any element 'any'
+ any text: '
+ '
+}
+
+{
+ x = x
+ any text: 'abc123'
+}
+
diff --git a/xsd-tests/cxx/parser/validation/built-in/any-type/test.xml b/xsd-tests/cxx/parser/validation/built-in/any-type/test.xml
new file mode 100644
index 0000000..7875b7e
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/any-type/test.xml
@@ -0,0 +1,41 @@
+<t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+ as="123abc">
+
+ <!-- test dispatching of anyType nested elements and attributes -->
+
+ <a>
+ <o:any/>
+ </a>
+
+ <a>
+ <o:any x="xxx">aaa<a>bbb</a>ccc</o:any>
+ </a>
+
+ <a x="x">
+ <a>a</a>
+ <o:any x="xxx">aaa<a>bbb</a>ccc</o:any>
+ </a>
+
+ <!-- anyType extension -->
+
+ <a-extension>
+ <o:any/>
+ </a-extension>
+
+ <a-extension>
+ <o:any x="xxx">aaa<a>bbb</a>ccc</o:any>
+ </a-extension>
+
+ <a-extension x="x">
+ <a>a</a>
+ <o:any x="xxx">aaa<a>bbb</a>ccc</o:any>
+ </a-extension>
+
+ <!-- anySimpleType extension -->
+
+ <as-extension x="x">abc123</as-extension>
+
+</t:root>
diff --git a/xsd-tests/cxx/parser/validation/built-in/any-type/test.xsd b/xsd-tests/cxx/parser/validation/built-in/any-type/test.xsd
new file mode 100644
index 0000000..86a4e13
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/any-type/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="any-extension">
+ <complexContent mixed="true">
+ <extension base="anyType">
+ <attribute name="x" type="string"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="any-simple-extension">
+ <simpleContent>
+ <extension base="anySimpleType">
+ <attribute name="x" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="type">
+ <choice maxOccurs="unbounded">
+ <element name="a" type="anyType"/>
+ <element name="a-extension" type="t:any-extension"/>
+ <element name="as-extension" type="t:any-simple-extension"/>
+ </choice>
+ <attribute name="as" type="anySimpleType"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/built-in/binary/buildfile b/xsd-tests/cxx/parser/validation/built-in/binary/buildfile
new file mode 100644
index 0000000..fd1594f
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/binary/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/binary/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/binary/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/binary/driver.cxx
new file mode 100644
index 0000000..3fe20ec
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/binary/driver.cxx
@@ -0,0 +1,153 @@
+// file : cxx/parser/validation/built-in/binary/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in base64Binary and hexBinary types validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ typedef xsd::cxx::parser::buffer buffer;
+
+ // Good.
+ //
+
+ // hexBinary
+ //
+ {
+ hex_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters (" ");
+ p._post ();
+ assert (*p.post_hex_binary () == buffer ());
+ }
+
+ {
+ hex_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n313");
+ p._characters ("23334356162636a6b ");
+ p._post ();
+ assert (*p.post_hex_binary () == buffer ("12345abcjk", 10));
+ }
+
+ // base64Binary
+ //
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("MTIzND ");
+ p._characters ("VhYmNqaw = = ");
+ p._post ();
+ assert (*p.post_base64_binary () == buffer ("12345abcjk", 10));
+ }
+
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("YQ==");
+ p._post ();
+ assert (*p.post_base64_binary () == buffer ("a", 1));
+ }
+
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("YWI=");
+ p._post ();
+ assert (*p.post_base64_binary () == buffer ("ab", 2));
+ }
+
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("YWJj");
+ p._post ();
+ assert (*p.post_base64_binary () == buffer ("abc", 3));
+ }
+
+ // Bad
+ //
+
+ // hexBinary
+ //
+ {
+ hex_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("313");
+ assert (test_post_fail (p));
+ }
+
+ {
+ hex_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("313233343X6162636a6b");
+ assert (test_post_fail (p));
+ }
+
+ // base64Binary
+ //
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("YQ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("==");
+ assert (test_post_fail (p));
+ }
+
+ {
+ base64_binary_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("MTIzNDVhYmNqaw=A");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/boolean/buildfile b/xsd-tests/cxx/parser/validation/built-in/boolean/buildfile
new file mode 100644
index 0000000..259614e
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/boolean/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/boolean/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/boolean/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/boolean/driver.cxx
new file mode 100644
index 0000000..f1499cd
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/boolean/driver.cxx
@@ -0,0 +1,145 @@
+// file : cxx/parser/validation/built-in/boolean/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in boolean type validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+bool
+test_post_fail (boolean_pimpl<char>& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("true");
+ p._post ();
+ assert (p.post_boolean ());
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1");
+ p._post ();
+ assert (p.post_boolean ());
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("false");
+ p._post ();
+ assert (!p.post_boolean ());
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (!p.post_boolean ());
+ }
+
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" true ");
+ p._post ();
+ assert (p.post_boolean ());
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ p._characters (" \n ");
+ p._characters (" fa");
+ p._characters ("l");
+ p._characters ("se ");
+ p._characters (" \n ");
+ p._characters (" ");
+ p._post ();
+ assert (!p.post_boolean ());
+ }
+
+ // Bad
+ //
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ //p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("fal");
+ p._characters ("s ");
+ p._characters ("e");
+ assert (test_post_fail (p));
+ }
+
+ {
+ boolean_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("01");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/byte/buildfile b/xsd-tests/cxx/parser/validation/built-in/byte/buildfile
new file mode 100644
index 0000000..87de911
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/byte/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/byte/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/byte/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/byte/driver.cxx
new file mode 100644
index 0000000..b533cfd
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/byte/driver.cxx
@@ -0,0 +1,256 @@
+// file : cxx/parser/validation/built-in/byte/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in byte and unsigned byte types validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("123");
+ p._post ();
+ assert (p.post_byte () == 123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("\t +123 \n ");
+ p._post ();
+ assert (p.post_byte () == 123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-123");
+ p._post ();
+ assert (p.post_byte () == -123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+123");
+ p._post ();
+ assert (p.post_byte () == 123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0000000000000000123");
+ p._post ();
+ assert (p.post_byte () == 123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+0000000000000000123");
+ p._post ();
+ assert (p.post_byte () == 123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0000000000000000123");
+ p._post ();
+ assert (p.post_byte () == -123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("\t \n");
+ p._characters (" -");
+ p._characters ("00000");
+ p._characters ("001");
+ p._characters ("23 \n\t");
+ p._post ();
+ assert (p.post_byte () == -123);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-128");
+ p._post ();
+ assert (p.post_byte () == -128);
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("127");
+ p._post ();
+ assert (p.post_byte () == 127);
+ }
+
+ {
+ unsigned_byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+123");
+ p._post ();
+ assert (p.post_unsigned_byte () == 123);
+ }
+
+ {
+ unsigned_byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_unsigned_byte () == 0);
+ }
+
+ {
+ unsigned_byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("255");
+ p._post ();
+ assert (p.post_unsigned_byte () == 255);
+ }
+
+ // Bad
+ //
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n \t ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("++01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-01");
+ p._characters (" ");
+ p._characters ("23 ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ unsigned_byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-123");
+ assert (test_post_fail (p));
+ }
+
+ // Ranges
+ //
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-129");
+ assert (test_post_fail (p));
+ }
+
+ {
+ byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("128");
+ assert (test_post_fail (p));
+ }
+
+ {
+ unsigned_byte_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("256");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/date-time/buildfile b/xsd-tests/cxx/parser/validation/built-in/date-time/buildfile
new file mode 100644
index 0000000..47791e5
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/date-time/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/date-time/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/date-time/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/date-time/driver.cxx
new file mode 100644
index 0000000..da02a50
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/date-time/driver.cxx
@@ -0,0 +1,1533 @@
+// file : cxx/parser/validation/built-in/date-time/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in date and time types validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ typedef xsd::cxx::parser::gday gday;
+ typedef xsd::cxx::parser::gmonth gmonth;
+ typedef xsd::cxx::parser::gyear gyear;
+ typedef xsd::cxx::parser::gmonth_day gmonth_day;
+ typedef xsd::cxx::parser::gyear_month gyear_month;
+ typedef xsd::cxx::parser::date date;
+ typedef xsd::cxx::parser::time time;
+ typedef xsd::cxx::parser::date_time date_time;
+ typedef xsd::cxx::parser::duration duration;
+
+ // Good.
+ //
+
+ // gday & time zone parsing
+ //
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("---1");
+ p._characters ("2+12:00");
+ p._post ();
+ assert (p.post_gday () == gday (12, 12, 00));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---01");
+ p._post ();
+ assert (p.post_gday () == gday (1));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---31");
+ p._post ();
+ assert (p.post_gday () == gday (31));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---15Z");
+ p._post ();
+ assert (p.post_gday () == gday (15, 0, 0));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---15-14:00");
+ p._post ();
+ assert (p.post_gday () == gday (15, -14, 0));
+ }
+
+ // gmonth
+ //
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("--1");
+ p._characters ("0+12:00");
+ p._post ();
+ assert (p.post_gmonth () == gmonth (10, 12, 0));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--01");
+ p._post ();
+ assert (p.post_gmonth () == gmonth (1));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12Z");
+ p._post ();
+ assert (p.post_gmonth () == gmonth (12, 0, 0));
+ }
+
+ // gyear
+ //
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("20");
+ p._characters ("07+12:00");
+ p._post ();
+ assert (p.post_gyear () == gyear (2007, 12, 00));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0001");
+ p._post ();
+ assert (p.post_gyear () == gyear (1));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-20000Z");
+ p._post ();
+ assert (p.post_gyear () == gyear (-20000, 0, 0));
+ }
+
+ // gmonth_day
+ //
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("--1");
+ p._characters ("0-28+12:00 ");
+ p._post ();
+ assert (p.post_gmonth_day () == gmonth_day (10, 28, 12, 00));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12-31");
+ p._post ();
+ assert (p.post_gmonth_day () == gmonth_day (12, 31));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--01-01Z");
+ p._post ();
+ assert (p.post_gmonth_day () == gmonth_day (1, 1, 0, 0));
+ }
+
+ // gyear_month
+ //
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("200");
+ p._characters ("7-12+12:00 ");
+ p._post ();
+ assert (p.post_gyear_month () == gyear_month (2007, 12, 12, 00));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-2007-10");
+ p._post ();
+ assert (p.post_gyear_month () == gyear_month (-2007, 10));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20007-10Z");
+ p._post ();
+ assert (p.post_gyear_month () == gyear_month (20007, 10, 0, 0));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-20007-01");
+ p._post ();
+ assert (p.post_gyear_month () == gyear_month (-20007, 1));
+ }
+
+ // date
+ //
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("200");
+ p._characters ("7-12-26+12:00 ");
+ p._post ();
+ assert (p.post_date () == date (2007, 12, 26, 12, 0));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-2007-10-15");
+ p._post ();
+ assert (p.post_date () == date (-2007, 10, 15));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20007-12-31Z");
+ p._post ();
+ assert (p.post_date () == date (20007, 12, 31, 0, 0));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-20007-01-01");
+ p._post ();
+ assert (p.post_date () == date (-20007, 1, 1));
+ }
+
+ // time
+ //
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("12:");
+ p._characters ("46:23.456+12:00 ");
+ p._post ();
+ assert (p.post_time () == time (12, 46, 23.456, 12, 0));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("12:13:14");
+ p._post ();
+ assert (p.post_time () == time (12, 13, 14.0));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("12:13:14Z");
+ p._post ();
+ assert (p.post_time () == time (12, 13, 14.0, 0, 0));
+ }
+
+ // date_time
+ //
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("200");
+ p._characters ("7-12-26T12:13:14.123+12:00 ");
+ p._post ();
+ assert (p.post_date_time () ==
+ date_time (2007, 12, 26, 12, 13, 14.123, 12, 0));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-2007-10-15T12:13:14");
+ p._post ();
+ assert (p.post_date_time () == date_time (-2007, 10, 15, 12, 13, 14.0));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20007-12-31T12:13:14Z");
+ p._post ();
+ assert (p.post_date_time () ==
+ date_time (20007, 12, 31, 12, 13, 14.0, 0, 0));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-20007-01-01T12:13:14");
+ p._post ();
+ assert (p.post_date_time () == date_time (-20007, 1, 1, 12, 13, 14.0));
+ }
+
+ // duration
+ //
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \t\n ");
+ p._characters ("-P200");
+ p._characters ("7Y13M32DT25H61M61.123S ");
+ p._post ();
+ assert (p.post_duration () ==
+ duration (true, 2007, 13, 32, 25, 61, 61.123));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1Y");
+ p._post ();
+ assert (p.post_duration () == duration (false, 1, 0, 0, 0, 0, 0.0));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1M");
+ p._post ();
+ assert (p.post_duration () == duration (false, 0, 1, 0, 0, 0, 0.0));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1D");
+ p._post ();
+ assert (p.post_duration () == duration (false, 0, 0, 1, 0, 0, 0.0));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT1H");
+ p._post ();
+ assert (p.post_duration () == duration (false, 0, 0, 0, 1, 0, 0.0));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT1M");
+ p._post ();
+ assert (p.post_duration () == duration (false, 0, 0, 0, 0, 1, 0.0));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT1.1S");
+ p._post ();
+ assert (p.post_duration () == duration (false, 0, 0, 0, 0, 0, 1.1));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1YT1S");
+ p._post ();
+ assert (p.post_duration () == duration (false, 1, 0, 0, 0, 0, 1.0));
+ }
+
+ // Bad
+ //
+
+ // gday & time zone parsing
+ //
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---1");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---32");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---2X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12asd");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---1212:00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12+2:00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12+1200");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12+15:00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12+12:60");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gday_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("---12+14:01");
+ assert (test_post_fail (p));
+ }
+
+ // gmonth
+ //
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--13");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--1X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--11+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // gyear
+ //
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("207");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-207");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0000");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20X7");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // gmonth_day
+ //
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-12-12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--1212");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12?12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--00-12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12-00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--13-23");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12-32");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--1X-12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--12-2X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gmonth_day_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("--11-11+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // gyear_month
+ //
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("207-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-207-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0000-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20X7-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007?12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-0");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-13");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-1X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ gyear_month_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // date
+ //
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("207-01-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-207-01-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0000-01-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20X7-01-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007?01-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-0-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-00-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-13-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-1X-01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10?12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-0");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-32");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-2X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // time
+ //
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1:01:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2X:01:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23?01:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:0:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:60:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:4X:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10?12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10:");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10:0");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10:01.");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10:60");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:10:2X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("24:01:00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("24:00:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:01:01+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // date_time
+ //
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("207-01-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-207-01-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0000-01-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("20X7-01-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007?01-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-0-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-00-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-13-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-1X-01T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10?12T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-0T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-00T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-32T12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-10-2XT12:13:14");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T1:01:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T2X:01:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23?01:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:0:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:60:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:4X:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10?12");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10:");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10:0");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10:01.");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10:60");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T23:10:2X");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T24:01:00");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T24:00:01");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("23:01:01+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ {
+ date_time_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007-01-01T12:13:14+12:3o");
+ assert (test_post_fail (p));
+ }
+
+ // duration
+ //
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ // p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2007Y");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-2007Y");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P-2007Y");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P-1M");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P-1D");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT-1H");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT-1M");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT-1.1S");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1H1M1S");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1M1Y");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT1S1H");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("PT1H1Y");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1Ygarbage");
+ assert (test_post_fail (p));
+ }
+
+ {
+ duration_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("P1YT");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/float/buildfile b/xsd-tests/cxx/parser/validation/built-in/float/buildfile
new file mode 100644
index 0000000..ca0eac1
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/float/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/float/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx
new file mode 100644
index 0000000..bb67eb7
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/float/driver.cxx
@@ -0,0 +1,285 @@
+// file : cxx/parser/validation/built-in/float/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in float, double, and decimal types validation.
+//
+#include <math.h>
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+
+ // float
+ //
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" 0000123.456 ");
+ p._post ();
+ assert (p.post_float () == 123.456F);
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-12.345E2");
+ p._post ();
+ assert (p.post_float () == -12.345E2F);
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_float () == 0.0F);
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0");
+ p._post ();
+ assert (p.post_float () == -0.0F);
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("INF");
+ p._post ();
+ assert (isinf (p.post_float ()));
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-INF");
+ p._post ();
+ assert (isinf (p.post_float ()));
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("NaN");
+ p._post ();
+ assert (isnan (p.post_float ()));
+ }
+
+ // double
+ //
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" 0000123.456789 ");
+ p._post ();
+ assert (p.post_double () == 123.456789);
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-12.3456789E2");
+ p._post ();
+ assert (p.post_double () == -12.3456789E2);
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_double () == 0.0);
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0");
+ p._post ();
+ assert (p.post_double () == -0.0);
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("INF");
+ p._post ();
+ assert (isinf (p.post_double ()));
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-INF");
+ p._post ();
+ assert (isinf (p.post_double ()));
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("NaN");
+ p._post ();
+ assert (isnan (p.post_double ()));
+ }
+
+ // decimal
+ //
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" 0000123.456789 ");
+ p._post ();
+ assert (p.post_decimal () == 123.456789);
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-123.45678912345");
+ p._post ();
+ assert (p.post_decimal () == -123.45678912345);
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_decimal () == 0.0);
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0");
+ p._post ();
+ assert (p.post_decimal () == -0.0);
+ }
+
+
+ // Bad
+ //
+
+ // float
+ //
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+INF");
+ assert (test_post_fail (p));
+ }
+
+ {
+ float_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1.45 E2");
+ assert (test_post_fail (p));
+ }
+
+ // double
+ //
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+INF");
+ assert (test_post_fail (p));
+ }
+
+ {
+ double_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1.45 E2");
+ assert (test_post_fail (p));
+ }
+
+ // decimal
+ //
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("INF");
+ assert (test_post_fail (p));
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+INF");
+ assert (test_post_fail (p));
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-INF");
+ assert (test_post_fail (p));
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("NaN");
+ assert (test_post_fail (p));
+ }
+
+ {
+ decimal_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1.45 2");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/int/buildfile b/xsd-tests/cxx/parser/validation/built-in/int/buildfile
new file mode 100644
index 0000000..51bdf12
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/int/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/int/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx
new file mode 100644
index 0000000..d31d206
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/int/driver.cxx
@@ -0,0 +1,116 @@
+// file : cxx/parser/validation/built-in/int/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in int and unsigned int types validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+ {
+ int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-2147483648");
+ p._post ();
+ assert (p.post_int () == -2147483648);
+ }
+
+ {
+ int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_int () == 0);
+ }
+
+ {
+ int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2147483647");
+ p._post ();
+ assert (p.post_int () == 2147483647);
+ }
+
+ {
+ unsigned_int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_unsigned_int () == 0);
+ }
+
+ {
+ unsigned_int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("4294967295");
+ p._post ();
+ assert (p.post_unsigned_int () == 4294967295);
+ }
+
+ // Bad
+ //
+
+ {
+ unsigned_int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-123");
+ assert (test_post_fail (p));
+ }
+
+
+ // Ranges
+ //
+ {
+ int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-2147483649");
+ assert (test_post_fail (p));
+ }
+
+ {
+ int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("2147483648");
+ assert (test_post_fail (p));
+ }
+
+ {
+ unsigned_int_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("4294967296");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/integer/buildfile b/xsd-tests/cxx/parser/validation/built-in/integer/buildfile
new file mode 100644
index 0000000..4d63a19
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/integer/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/integer/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/integer/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/integer/driver.cxx
new file mode 100644
index 0000000..3a5fdd5
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/integer/driver.cxx
@@ -0,0 +1,303 @@
+// file : cxx/parser/validation/built-in/integer/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in integer & friends types validation.
+//
+#include <limits.h>
+
+#include <string>
+#include <sstream>
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace std;
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+
+ std::string min;
+ std::string max;
+ std::string umax;
+
+ {
+ ostringstream ostr;
+ ostr << LLONG_MIN;
+ min = ostr.str ();
+ }
+
+ {
+ ostringstream ostr;
+ ostr << LLONG_MAX;
+ max = ostr.str ();
+ }
+
+ {
+ ostringstream ostr;
+ ostr << ULLONG_MAX;
+ umax = ostr.str ();
+ }
+
+ // integer
+ //
+ {
+ integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (min.c_str ());
+ p._post ();
+ assert (p.post_integer () == LLONG_MIN);
+ }
+
+ {
+ integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_integer () == 0);
+ }
+
+ {
+ integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (max.c_str ());
+ p._post ();
+ assert (p.post_integer () == LLONG_MAX);
+ }
+
+ // negative_integer
+ //
+ {
+ negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (min.c_str ());
+ p._post ();
+ assert (p.post_negative_integer () == LLONG_MIN);
+ }
+
+ {
+ negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-1");
+ p._post ();
+ assert (p.post_negative_integer () == -1);
+ }
+
+ // non_positive_integer
+ //
+ {
+ non_positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (min.c_str ());
+ p._post ();
+ assert (p.post_non_positive_integer () == LLONG_MIN);
+ }
+
+ {
+ non_positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+0");
+ p._post ();
+ assert (p.post_non_positive_integer () == 0);
+ }
+
+ // positive_integer
+ //
+ {
+ positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1");
+ p._post ();
+ assert (p.post_positive_integer () == 1);
+ }
+
+ {
+ positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (umax.c_str ());
+ p._post ();
+ assert (p.post_positive_integer () == ULLONG_MAX);
+ }
+
+ // non_negative_integer
+ //
+ /*
+ {
+ non_negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0");
+ p._post ();
+ assert (p.post_non_negative_integer () == 0);
+ }
+ */
+
+ {
+ non_negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_non_negative_integer () == 0);
+ }
+
+ {
+ non_negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (umax.c_str ());
+ p._post ();
+ assert (p.post_non_negative_integer () == ULLONG_MAX);
+ }
+
+
+ // Bad
+ //
+
+ std::string past_min (min);
+ std::string past_max (max);
+ std::string past_umax (umax);
+
+ assert (*past_min.rbegin () != '9');
+ assert (*past_max.rbegin () != '9');
+ assert (*past_umax.rbegin () != '9');
+
+ (*past_min.rbegin ())++;
+ (*past_max.rbegin ())++;
+ (*past_umax.rbegin ())++;
+
+ // integer
+ //
+ {
+ integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (past_min.c_str ());
+ assert (test_post_fail (p));
+ }
+
+ {
+ integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (past_max.c_str ());
+ assert (test_post_fail (p));
+ }
+
+ // negative_integer
+ //
+ {
+ negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (past_min.c_str ());
+ assert (test_post_fail (p));
+ }
+
+ {
+ negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-0");
+ assert (test_post_fail (p));
+ }
+
+ {
+ negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1");
+ assert (test_post_fail (p));
+ }
+
+ // non_positive_integer
+ //
+ {
+ non_positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (past_min.c_str ());
+ assert (test_post_fail (p));
+ }
+
+ {
+ non_positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1");
+ assert (test_post_fail (p));
+ }
+
+ // positive_integer
+ //
+ {
+ positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-1");
+ assert (test_post_fail (p));
+ }
+
+ {
+ positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("+0");
+ assert (test_post_fail (p));
+ }
+
+ {
+ positive_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (past_umax.c_str ());
+ assert (test_post_fail (p));
+ }
+
+ // non_negative_integer
+ //
+ {
+ non_negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-1");
+ assert (test_post_fail (p));
+ }
+
+ {
+ non_negative_integer_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (past_umax.c_str ());
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/long/buildfile b/xsd-tests/cxx/parser/validation/built-in/long/buildfile
new file mode 100644
index 0000000..285ad70
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/long/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/long/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/long/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/long/driver.cxx
new file mode 100644
index 0000000..a4ab565
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/long/driver.cxx
@@ -0,0 +1,116 @@
+// file : cxx/parser/validation/built-in/long/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in long and unsigned long types validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+ {
+ long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-9223372036854775808");
+ p._post ();
+ assert (p.post_long () == (-9223372036854775807LL - 1));
+ }
+
+ {
+ long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_long () == 0);
+ }
+
+ {
+ long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("9223372036854775807");
+ p._post ();
+ assert (p.post_long () == 9223372036854775807LL);
+ }
+
+ {
+ unsigned_long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_unsigned_long () == 0);
+ }
+
+ {
+ unsigned_long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("18446744073709551615");
+ p._post ();
+ assert (p.post_unsigned_long () == 18446744073709551615ULL);
+ }
+
+ // Bad
+ //
+
+ {
+ unsigned_long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-123");
+ assert (test_post_fail (p));
+ }
+
+
+ // Ranges
+ //
+ {
+ long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-9223372036854775809");
+ assert (test_post_fail (p));
+ }
+
+ {
+ long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("9223372036854775808");
+ assert (test_post_fail (p));
+ }
+
+ {
+ unsigned_long_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("18446744073709551616");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/qname/buildfile b/xsd-tests/cxx/parser/validation/built-in/qname/buildfile
new file mode 100644
index 0000000..47d644c
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/qname/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/qname/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/qname/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/qname/driver.cxx
new file mode 100644
index 0000000..85acd1c
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/qname/driver.cxx
@@ -0,0 +1,105 @@
+// file : cxx/parser/validation/built-in/qname/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in QName type validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+bool
+test_post_fail (qname_pimpl<char>& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ typedef xsd::cxx::parser::qname<char> qname;
+
+ // Good.
+ //
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" xsi");
+ p._characters (":");
+ p._characters ("schemaLocation");
+ p._post ();
+ assert (p.post_qname () == qname ("xsi", "schemaLocation"));
+ }
+
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("schemaLocation");
+ p._post ();
+ assert (p.post_qname () == qname ("schemaLocation"));
+ }
+
+
+ // Bad
+ //
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ //p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (":");
+ assert (test_post_fail (p));
+ }
+
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("xsi:");
+ assert (test_post_fail (p));
+ }
+
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (":schemaLocation");
+ assert (test_post_fail (p));
+ }
+
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("x?i:schemaLocation");
+ assert (test_post_fail (p));
+ }
+
+ {
+ qname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("xsi:schema Location");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/short/buildfile b/xsd-tests/cxx/parser/validation/built-in/short/buildfile
new file mode 100644
index 0000000..782b404
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/short/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/short/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/short/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/short/driver.cxx
new file mode 100644
index 0000000..7c79b22
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/short/driver.cxx
@@ -0,0 +1,116 @@
+// file : cxx/parser/validation/built-in/short/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in short and unsigned short types validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post ();
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ // Good.
+ //
+ {
+ short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-32768");
+ p._post ();
+ assert (p.post_short () == -32768);
+ }
+
+ {
+ short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_short () == 0);
+ }
+
+ {
+ short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("32767");
+ p._post ();
+ assert (p.post_short () == 32767);
+ }
+
+ {
+ unsigned_short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("0");
+ p._post ();
+ assert (p.post_unsigned_short () == 0);
+ }
+
+ {
+ unsigned_short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("65535");
+ p._post ();
+ assert (p.post_unsigned_short () == 65535);
+ }
+
+ // Bad
+ //
+
+ {
+ unsigned_short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-1234");
+ assert (test_post_fail (p));
+ }
+
+
+ // Ranges
+ //
+ {
+ short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-32769");
+ assert (test_post_fail (p));
+ }
+
+ {
+ short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("32768");
+ assert (test_post_fail (p));
+ }
+
+ {
+ unsigned_short_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("65536");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/string/buildfile b/xsd-tests/cxx/parser/validation/built-in/string/buildfile
new file mode 100644
index 0000000..83e5f7a
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/string/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/string/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/string/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/string/driver.cxx
new file mode 100644
index 0000000..920385a
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/string/driver.cxx
@@ -0,0 +1,512 @@
+// file : cxx/parser/validation/built-in/string/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in string & friends types validation.
+//
+#include <string>
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+template <typename T>
+bool
+test_post_fail (T& p)
+{
+ try
+ {
+ p._post_impl (); // List implementation needs this to be post_impl.
+ }
+ catch (invalid_value<char> const&)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int
+main ()
+{
+ typedef xsd::cxx::parser::string_sequence<char> strings;
+
+ // Good.
+ //
+
+ // string
+ //
+ {
+ string_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" aaa ");
+ p._characters ("bbb");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_string () == " \n\t aaa bbb ");
+ }
+
+ // normalized_string
+ //
+ {
+ normalized_string_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" aaa \n\t ");
+ p._characters (" bbb");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_normalized_string () == " aaa bbb ");
+ }
+
+ // token
+ //
+ {
+ token_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" aaa \n\t ");
+ p._characters (" bbb \n\t");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_token () == "aaa bbb");
+ }
+
+ // name
+ //
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" a:b-c_d123 ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_name () == "a:b-c_d123");
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" _12 ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_name () == "_12");
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" :12 ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_name () == ":12");
+ }
+
+ // nmtoken
+ //
+ {
+ nmtoken_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" 123a:b-c_d123 ");
+ p._characters (" \n\t");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_nmtoken () == "123a:b-c_d123");
+ }
+
+ // nmtokens
+ //
+ {
+ strings s;
+ s.push_back ("123");
+ s.push_back ("abc");
+
+ nmtokens_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" 123 ");
+ p._characters (" \n\t abc ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_nmtokens () == s);
+ }
+
+ // ncname
+ //
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" a.b-c_d123 ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_ncname () == "a.b-c_d123");
+ }
+
+ // id
+ //
+ {
+ id_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" a.b-c_d123 ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_id () == "a.b-c_d123");
+ }
+
+ // idref
+ //
+ {
+ idref_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" a.b-c_d123 ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_idref () == "a.b-c_d123");
+ }
+
+ // idrefs
+ //
+ {
+ strings s;
+ s.push_back ("a123");
+ s.push_back ("abc");
+
+ idrefs_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" \n\t");
+ p._characters (" a123 ");
+ p._characters (" \n\t abc ");
+ p._characters (" ");
+ p._post ();
+ assert (p.post_idrefs () == s);
+ }
+
+ // language
+ //
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" x ");
+ p._post ();
+ assert (p.post_language () == "x");
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" en ");
+ p._post ();
+ assert (p.post_language () == "en");
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" en");
+ p._characters ("-us ");
+ p._post ();
+ assert (p.post_language () == "en-us");
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("one-two-three-four44-seven77-eight888");
+ p._post ();
+ assert (p.post_language () == "one-two-three-four44-seven77-eight888");
+ }
+
+
+ // Bad
+ //
+
+ // name
+ //
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (".a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a,b");
+ assert (test_post_fail (p));
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a b");
+ assert (test_post_fail (p));
+ }
+
+ {
+ name_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a<b");
+ assert (test_post_fail (p));
+ }
+
+ // nmtoken
+ //
+ {
+ nmtoken_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ nmtoken_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a,b");
+ assert (test_post_fail (p));
+ }
+
+ {
+ nmtoken_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a b");
+ assert (test_post_fail (p));
+ }
+
+ {
+ nmtoken_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a<b");
+ assert (test_post_fail (p));
+ }
+
+ // nmtokens
+ //
+ {
+ nmtokens_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ p._characters (" \t\n ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ nmtokens_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("ab a,b");
+ assert (test_post_fail (p));
+ }
+
+ // ncname
+ //
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (".a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("-a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (":a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("1:a");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a,b");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a b");
+ assert (test_post_fail (p));
+ }
+
+ {
+ ncname_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a<b");
+ assert (test_post_fail (p));
+ }
+
+ // id
+ //
+ {
+ id_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a b");
+ assert (test_post_fail (p));
+ }
+
+ // idref
+ //
+ {
+ idref_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a b");
+ assert (test_post_fail (p));
+ }
+
+ // idrefs
+ //
+ {
+ idrefs_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ p._characters (" \t\n ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ idrefs_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("ab a<b");
+ assert (test_post_fail (p));
+ }
+
+ // language
+ //
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ assert (test_post_fail (p));
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("en-");
+ assert (test_post_fail (p));
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("a1");
+ assert (test_post_fail (p));
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("en+us");
+ assert (test_post_fail (p));
+ }
+
+ {
+ language_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("en-nine99999");
+ assert (test_post_fail (p));
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/built-in/uri/buildfile b/xsd-tests/cxx/parser/validation/built-in/uri/buildfile
new file mode 100644
index 0000000..a8fdf82
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/uri/buildfile
@@ -0,0 +1,10 @@
+# file : cxx/parser/validation/built-in/uri/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+
+exe{driver}: {hxx cxx}{*} $libs
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/parser/validation/built-in/uri/driver.cxx b/xsd-tests/cxx/parser/validation/built-in/uri/driver.cxx
new file mode 100644
index 0000000..dcc9242
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/built-in/uri/driver.cxx
@@ -0,0 +1,53 @@
+// file : cxx/parser/validation/built-in/uri/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the built-in anyURI type validation.
+//
+#include <cassert>
+
+#include <xsd/cxx/parser/validating/exceptions.hxx>
+#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx>
+
+using namespace xsd::cxx::parser::validating;
+
+int
+main ()
+{
+ // Good.
+ //
+ {
+ uri_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters (" ");
+ p._post ();
+ assert (p.post_uri () == "");
+ }
+
+ {
+ uri_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("relative");
+ p._post ();
+ assert (p.post_uri () == "relative");
+ }
+
+ {
+ uri_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("#id");
+ p._post ();
+ assert (p.post_uri () == "#id");
+ }
+
+ {
+ uri_pimpl<char> p;
+ p.pre ();
+ p._pre ();
+ p._characters ("http://www.example.com/foo#bar");
+ p._post ();
+ assert (p.post_uri () == "http://www.example.com/foo#bar");
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/choice/buildfile b/xsd-tests/cxx/parser/validation/choice/buildfile
new file mode 100644
index 0000000..adf0832
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/choice/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/parser/validation/choice/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs \
+ testscript
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/choice/driver.cxx b/xsd-tests/cxx/parser/validation/choice/driver.cxx
new file mode 100644
index 0000000..4a52c5d
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/choice/driver.cxx
@@ -0,0 +1,126 @@
+// file : cxx/parser/validation/choice/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the choice compositor validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+using xml_schema::ro_string;
+
+struct choice_pimpl: choice_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ b (string const& v)
+ {
+ cout << " b = " << v << endl;
+ }
+
+ virtual void
+ c (string const& v)
+ {
+ cout << " c = " << v << endl;
+ }
+
+ virtual void
+ d (string const& v)
+ {
+ cout << " d = " << v << endl;
+ }
+
+ virtual void
+ _start_any_element (ro_string const& ns,
+ ro_string const& name,
+ ro_string const*)
+ {
+ cout << " any: " << ns << "#" << name << endl
+ << " {" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& v)
+ {
+ cout << " chars = " << v << endl;
+ }
+
+ virtual void
+ _end_any_element (ro_string const&, ro_string const&)
+ {
+ cout << " }" << endl;
+ }
+
+ virtual void
+ post_choice ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ choice_pimpl choice_p;
+ type_pimpl type_p;
+
+ choice_p.parsers (string_p, string_p, string_p, string_p);
+ type_p.parsers (choice_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ try
+ {
+ ifstream ifs (argv[1]);
+ type_p.pre ();
+ doc_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cout << " " << e << endl
+ << "}" << endl
+ << endl;
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/choice/test.xsd b/xsd-tests/cxx/parser/validation/choice/test.xsd
new file mode 100644
index 0000000..8132bbb
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/choice/test.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="choice">
+ <choice maxOccurs="3">
+ <element name="a" type="string"/>
+ <element name="b" type="string" maxOccurs="unbounded"/>
+ <sequence>
+ <element name="c" type="string" minOccurs="0"/>
+ <element name="d" type="string"/>
+ </sequence>
+ <any namespace="other" maxOccurs="unbounded"/>
+ </choice>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="choice" type="t:choice" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/choice/testscript b/xsd-tests/cxx/parser/validation/choice/testscript
new file mode 100644
index 0000000..c5f5afa
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/choice/testscript
@@ -0,0 +1,179 @@
+# file : cxx/parser/validation/choice/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+test.arguments += test.xml
+
+: valid
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <choice>
+ <a>a</a>
+
+ <b>b</b>
+ </choice>
+
+ <choice>
+ <c>c</c>
+ <d>d</d>
+
+ <o:any>any</o:any>
+
+ <a>a</a>
+ </choice>
+
+ <choice>
+ <c>c</c>
+ <d>d</d>
+
+ <d>d</d>
+
+ <a>a</a>
+ </choice>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ a = a
+ b = b
+ }
+
+ {
+ c = c
+ d = d
+ any: other#any
+ {
+ chars = any
+ }
+ a = a
+ }
+
+ {
+ c = c
+ d = d
+ d = d
+ a = a
+ }
+
+ EOO
+}
+
+: absent1
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- invalid -->
+ <choice>
+ </choice>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ :8:12 error: expected element 'a'
+ }
+
+ EOO
+}
+
+: absent2
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- invalid -->
+ <choice>
+ <c>c</c>
+ <d>d</d>
+
+ <o:any>any</o:any>
+
+ <a>a</a>
+ <b>b</b>
+ </choice>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ c = c
+ d = d
+ any: other#any
+ {
+ chars = any
+ }
+ a = a
+ :14:8 error: unexpected element 'b'
+ }
+
+ EOO
+}
+
+: absent3
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- invalid -->
+ <choice>
+ <c>c</c>
+ </choice>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ c = c
+ :9:12 error: expected element 'd'
+ }
+
+ EOO
+}
+
+: absent4
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- invalid -->
+ <choice>
+ <x>x</x>
+ </choice>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ :8:8 error: expected element 'a' instead of 'x'
+ }
+
+ EOO
+}
diff --git a/xsd-tests/cxx/parser/validation/restriction/buildfile b/xsd-tests/cxx/parser/validation/restriction/buildfile
new file mode 100644
index 0000000..4c415bf
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/restriction/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/parser/validation/restriction/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs \
+ testscript
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/restriction/driver.cxx b/xsd-tests/cxx/parser/validation/restriction/driver.cxx
new file mode 100644
index 0000000..206b9f8
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/restriction/driver.cxx
@@ -0,0 +1,107 @@
+// file : cxx/parser/validation/restriction/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the restriction compositor validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+
+struct base_a_pimpl: base_a_pskel
+{
+};
+
+struct restriction_a_pimpl: restriction_a_pskel
+{
+};
+
+struct extension_b_pimpl: extension_b_pskel
+{
+};
+
+struct restriction_b_pimpl: restriction_b_pskel
+{
+};
+
+struct type_b_pimpl: type_b_pskel
+{
+};
+
+struct type_r_pimpl: type_r_pskel
+{
+};
+
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ base_a_pimpl base_a_p;
+ restriction_a_pimpl restriction_a_p;
+ extension_b_pimpl extension_b_p;
+ restriction_b_pimpl restriction_b_p;
+ type_b_pimpl type_b_p;
+ type_r_pimpl type_r_p;
+
+ base_a_p.parsers (string_p, string_p, string_p,
+ string_p, string_p, string_p);
+
+ restriction_a_p.parsers (string_p, string_p, string_p,
+ string_p, string_p, string_p);
+
+ extension_b_p.parsers (string_p, string_p, string_p,
+ string_p, string_p);
+
+ restriction_b_p.parsers (string_p, string_p, string_p,
+ string_p, string_p);
+
+ type_b_p.parsers (base_a_p, extension_b_p);
+ type_r_p.parsers (restriction_a_p, restriction_b_p);
+
+ xml_schema::document doc_b_p (type_b_p, "test", "root");
+ xml_schema::document doc_r_p (type_r_p, "test", "root");
+
+ {
+ ifstream ifs (argv[1]);
+ type_b_p.pre ();
+ doc_b_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_b_p.post_type_b ();
+ }
+
+ try
+ {
+ ifstream ifs (argv[1]);
+ type_r_p.pre ();
+ doc_r_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_r_p.post_type_r ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cout << e << endl;
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/restriction/test.xsd b/xsd-tests/cxx/parser/validation/restriction/test.xsd
new file mode 100644
index 0000000..158ded5
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/restriction/test.xsd
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- simple case -->
+ <complexType name="base-a">
+ <sequence minOccurs="1" maxOccurs="2">
+ <element name="a" type="string" minOccurs="0"/>
+ <element name="b" type="string"/>
+ <element name="c" type="string"/>
+ </sequence>
+ <attribute name="x" type="string"/>
+ <attribute name="y" type="string"/>
+ <attribute name="z" type="string"/>
+ </complexType>
+
+ <complexType name="restriction-a">
+ <complexContent>
+ <restriction base="t:base-a">
+ <sequence minOccurs="1" maxOccurs="1">
+ <element name="a" type="string" minOccurs="1"/>
+ <element name="b" type="string"/>
+ <element name="c" type="string"/>
+ </sequence>
+ <!-- Can be ommited if not changed, e.g., 'x'. -->
+ <attribute name="y" type="string"/> <!-- But can also be repeated without change. -->
+ <attribute name="z" type="string" use="required"/>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+ <!-- restriction of an extension -->
+ <complexType name="base-b">
+ <sequence>
+ <element name="a" type="string" minOccurs="0"/>
+ </sequence>
+ <attribute name="x" type="string"/>
+ </complexType>
+
+ <complexType name="extension-b">
+ <complexContent>
+ <extension base="t:base-b">
+ <choice>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string"/>
+ </choice>
+ <attribute name="y" type="string"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="restriction-b">
+ <complexContent>
+ <restriction base="t:extension-b">
+ <sequence>
+ <sequence>
+ <element name="a" type="string" minOccurs="1"/>
+ </sequence>
+ <choice>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string"/>
+ </choice>
+ </sequence>
+ <attribute name="y" type="string" use="required"/>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+ <complexType name="type-b">
+ <choice maxOccurs="unbounded">
+ <element name="restriction-a" type="t:base-a"/>
+ <element name="restriction-b" type="t:extension-b"/>
+ </choice>
+ </complexType>
+
+ <complexType name="type-r">
+ <choice maxOccurs="unbounded">
+ <element name="restriction-a" type="t:restriction-a"/>
+ <element name="restriction-b" type="t:restriction-b"/>
+ </choice>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/restriction/testscript b/xsd-tests/cxx/parser/validation/restriction/testscript
new file mode 100644
index 0000000..ea5a4e8
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/restriction/testscript
@@ -0,0 +1,159 @@
+# file : cxx/parser/validation/all/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+test.arguments += test.xml
+
+: valid
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <restriction-a z="z">
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ </restriction-a>
+
+ <restriction-a x="x" y="y" z="z">
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ </restriction-a>
+
+ <restriction-b y="y">
+ <a>a</a>
+ <b>b</b>
+ </restriction-b>
+
+ <restriction-b y="y">
+ <a>a</a>
+ <c>c</c>
+ </restriction-b>
+
+ <restriction-b x="x" y="y">
+ <a>a</a>
+ </restriction-b>
+
+ </t:root>
+ EOI
+
+ $*
+}
+
+: invalid1
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- valid base but not restriction: a element -->
+ <restriction-a z="z">
+ <b>b</b>
+ <c>c</c>
+ </restriction-a>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ :7:8 error: expected element 'a' instead of 'b'
+ EOO
+}
+
+: invalid2
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- valid base but not restriction: z attribute -->
+ <restriction-a>
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ </restriction-a>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ :10:19 error: expected attribute 'z'
+ EOO
+}
+
+: invalid3
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- valid base but not restriction: sequence maxOccurs="1" -->
+ <restriction-a z="z">
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ </restriction-a>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ :11:8 error: unexpected element 'a'
+ EOO
+}
+
+: invalid4
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- valid extension but not restriction: a element -->
+ <restriction-b y="y">
+ <b>b</b>
+ </restriction-b>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ :7:8 error: expected element 'a' instead of 'b'
+ EOO
+}
+
+: invalid5
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- valid extension but not restriction: y attribute -->
+ <restriction-b>
+ <a>a</a>
+ <b>b</b>
+ </restriction-b>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ :9:19 error: expected attribute 'y'
+ EOO
+}
diff --git a/xsd-tests/cxx/parser/validation/sequence/buildfile b/xsd-tests/cxx/parser/validation/sequence/buildfile
new file mode 100644
index 0000000..b205091
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/sequence/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/parser/validation/sequence/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test-pskel} {hxx ixx cxx}{test-pskel} $libs \
+ testscript
+
+<{hxx ixx cxx}{test-pskel}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-parser --std c++11 \
+ --generate-inline \
+ --skel-file-suffix -pskel \
+ --output-dir $out_base \
+ --generate-validation \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/parser/validation/sequence/driver.cxx b/xsd-tests/cxx/parser/validation/sequence/driver.cxx
new file mode 100644
index 0000000..6b5bf70
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/sequence/driver.cxx
@@ -0,0 +1,139 @@
+// file : cxx/parser/validation/sequence/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the sequence compositor validation.
+//
+
+#include <string>
+#include <fstream>
+#include <iostream>
+
+#include "test-pskel.hxx"
+
+using namespace std;
+using namespace test;
+using xml_schema::ro_string;
+
+struct sequence_pimpl: sequence_pskel
+{
+ virtual void
+ pre ()
+ {
+ cout << "{" << endl;
+ }
+
+ virtual void
+ a (string const& v)
+ {
+ cout << " a = " << v << endl;
+ }
+
+ virtual void
+ b (string const& v)
+ {
+ cout << " b = " << v << endl;
+ }
+
+ virtual void
+ c (string const& v)
+ {
+ cout << " c = " << v << endl;
+ }
+
+ virtual void
+ d (string const& v)
+ {
+ cout << " d = " << v << endl;
+ }
+
+ virtual void
+ e (string const& v)
+ {
+ cout << " e = " << v << endl;
+ }
+
+ virtual void
+ f (string const& v)
+ {
+ cout << " f = " << v << endl;
+ }
+
+ virtual void
+ _start_any_element (ro_string const& ns,
+ ro_string const& name,
+ ro_string const*)
+ {
+ cout << " any: " << ns << "#" << name << endl
+ << " {" << endl;
+ }
+
+ virtual void
+ _any_characters (ro_string const& v)
+ {
+ cout << " chars = " << v << endl;
+ }
+
+ virtual void
+ _end_any_element (ro_string const&, ro_string const&)
+ {
+ cout << " }" << endl;
+ }
+
+ virtual void
+ post_sequence ()
+ {
+ cout << "}" << endl
+ << endl;
+ }
+};
+
+struct type_pimpl: type_pskel
+{
+};
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ xml_schema::string_pimpl string_p;
+ sequence_pimpl sequence_p;
+ type_pimpl type_p;
+
+ sequence_p.parsers (string_p, string_p, string_p,
+ string_p, string_p, string_p);
+ type_p.parsers (sequence_p);
+
+ xml_schema::document doc_p (type_p, "test", "root");
+
+ try
+ {
+ ifstream ifs (argv[1]);
+ type_p.pre ();
+ doc_p.parse (ifs, argv[1], "", xml_schema::flags::dont_validate);
+ type_p.post_type ();
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cout << " " << e << endl
+ << "}" << endl
+ << endl;
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+ catch (ios_base::failure const&)
+ {
+ cerr << "io failure" << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/parser/validation/sequence/test.xsd b/xsd-tests/cxx/parser/validation/sequence/test.xsd
new file mode 100644
index 0000000..8753f54
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/sequence/test.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="sequence">
+ <sequence minOccurs="1" maxOccurs="2">
+ <element name="a" type="string" minOccurs="0"/>
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string"/>
+ </sequence>
+ <element name="d" type="string" maxOccurs="unbounded"/>
+ <sequence>
+ <any namespace="##targetNamespace other"/>
+ <element name="f" type="string"/>
+ </sequence>
+ <element name="e" type="string" maxOccurs="2"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="sequence" type="t:sequence" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/parser/validation/sequence/testscript b/xsd-tests/cxx/parser/validation/sequence/testscript
new file mode 100644
index 0000000..deebb9f
--- /dev/null
+++ b/xsd-tests/cxx/parser/validation/sequence/testscript
@@ -0,0 +1,328 @@
+# file : cxx/parser/validation/sequence/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+test.arguments += test.xml
+
+: valid
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <sequence>
+ <c>c</c>
+ <d>d</d>
+ <t:any>aaa<a>bbb</a>ccc</t:any>
+ <f>f</f>
+ <e>e</e>
+ </sequence>
+
+ <sequence>
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ <d>d</d>
+ <d>d</d>
+ <d>d</d>
+ <o:any>any</o:any>
+ <f>f</f>
+ <e>e</e>
+ <e>e</e>
+ </sequence>
+
+ <sequence>
+ <a>a</a>
+ <b>b</b>
+ <c>c</c>
+ <d>d</d>
+ <d>d</d>
+ <d>d</d>
+ <o:any>any</o:any>
+ <f>f</f>
+ <e>e</e>
+ <e>e</e>
+
+ <c>c</c>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ c = c
+ d = d
+ any: test#any
+ {
+ chars = aaa
+ any: #a
+ {
+ chars = bbb
+ }
+ chars = ccc
+ }
+ f = f
+ e = e
+ }
+
+ {
+ a = a
+ b = b
+ c = c
+ d = d
+ d = d
+ d = d
+ any: other#any
+ {
+ chars = any
+ }
+ f = f
+ e = e
+ e = e
+ }
+
+ {
+ a = a
+ b = b
+ c = c
+ d = d
+ d = d
+ d = d
+ any: other#any
+ {
+ chars = any
+ }
+ f = f
+ e = e
+ e = e
+ c = c
+ d = d
+ any: test#any
+ {
+ chars = any
+ }
+ f = f
+ e = e
+ }
+
+ EOO
+}
+
+: invalid1
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- fail minOccurs="1" -->
+ <sequence>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ :8:14 error: expected element 'a'
+ }
+
+ EOO
+}
+
+: invalid2
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- fail maxOccurs="2" -->
+ <sequence>
+ <c>c</c>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+
+ <c>c</c>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+
+ <c>c</c>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ c = c
+ d = d
+ any: test#any
+ {
+ chars = any
+ }
+ f = f
+ e = e
+ c = c
+ d = d
+ any: test#any
+ {
+ chars = any
+ }
+ f = f
+ e = e
+ :20:8 error: unexpected element 'c'
+ }
+
+ EOO
+}
+
+: invalid3
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- fail a maxOccurs="1" -->
+ <sequence>
+ <a>a</a>
+ <a>a</a>
+ <c>c</c>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ a = a
+ :9:8 error: expected element 'b' instead of 'a'
+ }
+
+ EOO
+}
+
+: invalid4
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- fail c minOccurs="1" -->
+ <sequence>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ :8:8 error: expected element 'a' instead of 'd'
+ }
+
+ EOO
+}
+
+: invalid5
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o1="other1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- fail any namespace="##targetNamespace other" -->
+ <sequence>
+ <c>c</c>
+ <d>d</d>
+ <o1:any>any</o1:any>
+ <f>f</f>
+ <e>e</e>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ c = c
+ d = d
+ :10:13 error: expected element '##targetNamespace#*' instead of 'other1#any'
+ }
+
+ EOO
+}
+
+: invalid6
+:
+{
+ cat <<EOI >=test.xml;
+ <t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <!-- fail e maxOccurs="2" -->
+ <sequence>
+ <c>c</c>
+ <d>d</d>
+ <t:any>any</t:any>
+ <f>f</f>
+ <e>e</e>
+ <e>e</e>
+ <e>e</e>
+ </sequence>
+
+ </t:root>
+ EOI
+
+ $* >>EOO
+ {
+ c = c
+ d = d
+ any: test#any
+ {
+ chars = any
+ }
+ f = f
+ e = e
+ e = e
+ :14:8 error: unexpected element 'e'
+ }
+
+ EOO
+}
diff --git a/xsd-tests/cxx/tree/any-type/buildfile b/xsd-tests/cxx/tree/any-type/buildfile
new file mode 100644
index 0000000..c65c403
--- /dev/null
+++ b/xsd-tests/cxx/tree/any-type/buildfile
@@ -0,0 +1,26 @@
+# file : cxx/tree/any-type/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-any-type \
+ --generate-ostream \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/any-type/driver.cxx b/xsd-tests/cxx/tree/any-type/driver.cxx
new file mode 100644
index 0000000..a8fccf6
--- /dev/null
+++ b/xsd-tests/cxx/tree/any-type/driver.cxx
@@ -0,0 +1,144 @@
+// file : cxx/tree/any-type/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test anyType and anySimpleType content extraction.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <utility> // std::move
+#include <sstream>
+#include <iostream>
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx" // Get XSD_CXX11 defined.
+
+#include <xsd/cxx/xml/string.hxx>
+
+using namespace std;
+using namespace test;
+using namespace xercesc;
+
+namespace xml = xsd::cxx::xml;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ // Test parsing
+ //
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ // Test API.
+ //
+ {
+ assert (type::a_default_value ().text_content () == "default value");
+ }
+
+ {
+ xml_schema::simple_type x ("fox");
+ assert (x.text_content () == "fox");
+ x.text_content ("foo");
+ assert (x.text_content () == "foo");
+ x.text_content ().clear ();
+ assert (x.text_content () == "");
+ x.text_content () = "baz";
+ r->s ().push_back (x);
+ }
+
+ {
+ xml_schema::type x;
+
+ DOMDocument& doc (x.dom_content_document ());
+
+ // Copy.
+ //
+ DOMElement* e (doc.createElement (xml::string ("dummy").c_str ()));
+ e->setAttribute (xml::string ("x").c_str (),
+ xml::string ("foo").c_str ());
+ e->setTextContent (xml::string ("data").c_str ());
+ x.dom_content ().set (*e);
+ e->release ();
+
+ r->t ().push_back (x);
+ }
+
+ {
+ XSD_AUTO_PTR<xml_schema::type> x (new xml_schema::type);
+
+ DOMDocument& doc (x->dom_content_document ());
+
+ // Assume ownership.
+ //
+ DOMElement* e (doc.createElement (xml::string ("dummy").c_str ()));
+ e->setAttribute (xml::string ("x").c_str (),
+ xml::string ("foo").c_str ());
+ e->setTextContent (xml::string ("data").c_str ());
+ x->dom_content ().set (e);
+
+#ifdef XSD_CXX11
+ r->t ().push_back (std::move (x));
+#else
+ r->t ().push_back (x);
+#endif
+ }
+
+ // Test printing.
+ //
+ cout << *r << endl
+ << endl;
+
+ // Test serialization.
+ //
+ xml_schema::namespace_infomap map;
+
+ map["t"].name = "test";
+ map["t"].schema = "test.xsd";
+ map["o"].name = "other";
+
+ stringstream iostr;
+ root (iostr, *r, map);
+
+ cout << iostr.str () << endl
+ << endl;
+
+ {
+ XSD_AUTO_PTR<type> r1 (root (iostr, argv[1]));
+
+ // Xerces-C++ mis-indentation of mixed content messes this up.
+ // assert (*r == *r);
+
+ stringstream iostr;
+ root (iostr, *r1, map);
+
+ cout << iostr.str () << endl
+ << endl;
+ }
+
+ // Test comparison.
+ //
+ assert (*r == *r);
+
+ // Test copy c-tor.
+ //
+ type copy (*r);
+ assert (copy == *r);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Terminate ();
+}
diff --git a/xsd-tests/cxx/tree/any-type/output b/xsd-tests/cxx/tree/any-type/output
new file mode 100644
index 0000000..580e7db
--- /dev/null
+++ b/xsd-tests/cxx/tree/any-type/output
@@ -0,0 +1,73 @@
+
+t:
+t:
+t:
+t:
+t:
+t:
+t:
+t:
+s:
+s: simple
+s: baz
+l: one two three
+a: any simple content
+
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test" a="any simple content" xmlns:o="other" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="test test.xsd">
+ <t/>
+ <t x="x"/>
+ <t>any</t>
+ <t x="x">any</t>
+ <t o:y="y" x="x">
+ <n1>
+ <n2>nested 1</n2>
+ <n2>nested 2</n2>
+ </n1>
+ <o:n2 o:x="x">more</o:n2>
+ </t><t x="x">
+ <n1>mi
+ <n2>nested 1</n2>x
+ <n2>nested 2</n2>ed
+ </n1>content
+ </t>
+ <t x="foo">data</t>
+ <t x="foo">data</t>
+ <s/>
+ <s>simple</s>
+ <s>baz</s>
+ <l>one two three</l>
+</t:root>
+
+
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test" a="any simple content" xmlns:o="other" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="test test.xsd">
+ <t/>
+ <t x="x"/>
+ <t>any</t>
+ <t x="x">any</t>
+ <t o:y="y" x="x">
+ <n1>
+ <n2>nested 1</n2>
+ <n2>nested 2</n2>
+ </n1>
+ <o:n2 o:x="x">more</o:n2>
+ </t><t x="x">
+ <n1>mi
+
+ <n2>nested 1</n2>x
+
+ <n2>nested 2</n2>ed
+
+ </n1>content
+
+ </t>
+ <t x="foo">data</t>
+ <t x="foo">data</t>
+ <s/>
+ <s>simple</s>
+ <s>baz</s>
+ <l>one two three</l>
+</t:root>
+
+
diff --git a/xsd-tests/cxx/tree/any-type/test.xml b/xsd-tests/cxx/tree/any-type/test.xml
new file mode 100644
index 0000000..7c9035a
--- /dev/null
+++ b/xsd-tests/cxx/tree/any-type/test.xml
@@ -0,0 +1,26 @@
+<t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+
+ a="any simple content">
+
+ <t/>
+ <t x="x"/>
+ <t>any</t>
+ <t x="x">any</t>
+ <t x="x" o:y="y">
+ <n1>
+ <n2>nested 1</n2>
+ <n2>nested 2</n2>
+ </n1>
+ <o:n2 o:x="x">more</o:n2>
+ </t>
+ <t x="x"><n1>mi<n2>nested 1</n2>x<n2>nested 2</n2>ed</n1>content</t>
+
+ <s/>
+ <s>simple</s>
+
+ <l>one two three</l>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/any-type/test.xsd b/xsd-tests/cxx/tree/any-type/test.xsd
new file mode 100644
index 0000000..37dcc8d
--- /dev/null
+++ b/xsd-tests/cxx/tree/any-type/test.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="any-list">
+ <!--Not allowed? list itemType="anySimpleType"/-->
+ <list itemType="string"/>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="t" type="anyType" maxOccurs="unbounded"/>
+ <element name="s" type="anySimpleType" maxOccurs="unbounded"/>
+ <element name="l" type="t:any-list" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="a" type="anySimpleType" default="default value"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+</schema>
diff --git a/xsd-tests/cxx/tree/binary/cdr/buildfile b/xsd-tests/cxx/tree/binary/cdr/buildfile
new file mode 100644
index 0000000..7a1c5b4
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/cdr/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/binary/cdr/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+import libs += libace%lib{ACE}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-insertion 'ACE_OutputCDR' \
+ --generate-extraction 'ACE_InputCDR' \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/binary/cdr/driver.cxx b/xsd-tests/cxx/tree/binary/cdr/driver.cxx
new file mode 100644
index 0000000..fe74bb5
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/cdr/driver.cxx
@@ -0,0 +1,143 @@
+// file : tests/cxx/tree/binary/cdr/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test non-polymorphic binary serialization to ACE CDR.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ // Save to a CDR stream.
+ //
+ ACE_OutputCDR ace_ocdr;
+ xml_schema::ostream<ACE_OutputCDR> ocdr (ace_ocdr);
+ ocdr << *r;
+
+ // Load from a CDR stream.
+ //
+ ACE_InputCDR ace_icdr (ace_ocdr);
+ xml_schema::istream<ACE_InputCDR> icdr (ace_icdr);
+ XSD_AUTO_PTR<type> c (new type (icdr));
+
+ // Compare the two.
+ //
+ assert (r->list () == c->list ());
+ assert (r->union_ () == c->union_ ());
+ assert (r->enumeration () == c->enumeration ());
+
+ type::complex_sequence rs (r->complex ()), cs (c->complex ());
+
+ for (type::complex_iterator ri (rs.begin ()), ci (cs.begin ());
+ ri != rs.end () && ci != rs.end (); ++ri, ++ci)
+ {
+ assert (ri->a () == ci->a ());
+ if (ri->b ())
+ assert (ri->b () == ci->b ());
+ assert (ri->c () == ci->c ());
+
+ assert (ri->x () == ci->x ());
+ if (ri->y ())
+ assert (ri->y () == ci->y ());
+ }
+
+ // integers
+ //
+ assert (r->byte () == c->byte ());
+ assert (r->unsigned_byte () == c->unsigned_byte ());
+ assert (r->short_ () == c->short_ ());
+ assert (r->unsigned_short () == c->unsigned_short ());
+ assert (r->int_ () == c->int_ ());
+ assert (r->unsigned_int () == c->unsigned_int ());
+ assert (r->long_ () == c->long_ ());
+ assert (r->unsigned_long () == c->unsigned_long ());
+ assert (r->integer () == c->integer ());
+ assert (r->non_positive_integer () == c->non_positive_integer ());
+ assert (r->non_negative_integer () == c->non_negative_integer ());
+ assert (r->positive_integer () == c->positive_integer ());
+ assert (r->negative_integer () == c->negative_integer ());
+
+ // boolean
+ //
+ assert (r->boolean () == c->boolean ());
+
+ // floats
+ //
+ assert (r->float_ () == c->float_ ());
+ assert (r->double_ () == c->double_ ());
+ assert (r->decimal () == c->decimal ());
+
+ // strings
+ //
+ assert (r->string () == c->string ());
+ assert (r->normalized_string () == c->normalized_string ());
+ assert (r->token () == c->token ());
+ assert (r->name () == c->name ());
+ assert (r->name_token () == c->name_token ());
+ assert (r->name_tokens () == c->name_tokens ());
+ assert (r->ncname () == c->ncname ());
+ assert (r->language () == c->language ());
+
+ // qualified name
+ //
+ assert (r->qname () == c->qname ());
+
+ // ID/IDREF
+ //
+ assert (r->id () == c->id ());
+ assert (r->id_ref () == c->id_ref ());
+ assert (r->id_refs () == c->id_refs ());
+
+ // URI
+ //
+ assert (r->any_uri () == c->any_uri ());
+
+ // binary
+ //
+ assert (r->base64_binary () == c->base64_binary ());
+ assert (r->hex_binary () == c->hex_binary ());
+
+ // date/time
+ //
+ assert (r->day () == c->day ());
+ assert (r->month () == c->month ());
+ assert (r->year () == c->year ());
+ assert (r->month_day () == c->month_day ());
+ assert (r->year_month () == c->year_month ());
+ assert (r->date () == c->date ());
+ assert (r->time () == c->time ());
+ assert (r->date_time () == c->date_time ());
+ assert (r->duration () == c->duration ());
+
+ // anySimpleType
+ //
+ assert (!r->any_simple_type_attr ().text_content ().empty ());
+ assert (r->any_simple_type_attr () == c->any_simple_type_attr ());
+
+ assert (!r->any_simple_type ().text_content ().empty ());
+ assert (r->any_simple_type () == c->any_simple_type ());
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/binary/cdr/test.xml b/xsd-tests/cxx/tree/binary/cdr/test.xml
new file mode 100644
index 0000000..5cedd98
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/cdr/test.xml
@@ -0,0 +1,93 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+ any_simple_type_attr="any simple content">
+
+ <list>1 2 3</list>
+
+ <union>abc</union>
+
+ <enumeration>left</enumeration>
+
+ <complex x="1">
+ <a>aaa</a>
+ </complex>
+ <complex x="1" y="2">
+ <a>aaa</a>
+ <b>bbb</b>
+ <c>c</c>
+ <c>cc</c>
+ <c>ccc</c>
+ </complex>
+
+
+ <!-- integers -->
+ <byte>65</byte>
+ <unsigned_byte>66</unsigned_byte>
+ <short>-222</short>
+ <unsigned_short>57005</unsigned_short>
+ <int>-57005</int>
+ <unsigned_int>3735928559</unsigned_int>
+ <long>-3735928559</long>
+ <unsigned_long>16045690984833335023</unsigned_long>
+ <integer>-3735928559</integer>
+ <non_positive_integer>-3735928559</non_positive_integer>
+ <non_negative_integer>3735928559</non_negative_integer>
+ <positive_integer>3735928559</positive_integer>
+ <negative_integer>-3735928559</negative_integer>
+
+
+ <!-- boolean -->
+ <boolean>true</boolean>
+
+
+ <!-- floats -->
+ <float>1234.1234</float>
+ <double>12345678.12345678</double>
+ <decimal>1234567812345678.1234567812345678</decimal>
+
+
+ <!-- strings -->
+ <string>string</string>
+ <normalized_string>normalized string</normalized_string>
+ <token>one two three</token>
+ <name>name</name>
+ <name_token>name-token</name_token>
+ <name_tokens>name tokens</name_tokens>
+ <ncname>ncname</ncname>
+ <language>en-us</language>
+
+ <!-- qualified name -->
+ <qname>xsi:schemaLocation</qname>
+
+
+ <!-- ID/IDREF -->
+ <id>elements1</id>
+ <id>elements2</id>
+ <id_ref>elements1</id_ref>
+ <id_refs>elements1 elements2</id_refs>
+
+
+ <!-- URI -->
+ <any_uri>http://www.codesynthesis.com</any_uri>
+
+
+ <!-- binary -->
+ <base64_binary>YmFzZTY0IGJpbmFyeQ==</base64_binary>
+ <hex_binary>6865782052696E617279</hex_binary>
+
+
+ <!-- date/time -->
+ <date>2001-10-26+02:00</date>
+ <date_time>2001-10-26T21:32:52+02:00</date_time>
+ <duration>P1Y2M3DT5H20M30S</duration>
+ <day>---01+02:00</day>
+ <month>--11+02:00</month>
+ <month_day>--11-02+02:00</month_day>
+ <year>2001+02:00</year>
+ <year_month>2001-11+02:00</year_month>
+ <time>21:32:52+02:00</time>
+
+ <any_simple_type>any simple content in element</any_simple_type>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/binary/cdr/test.xsd b/xsd-tests/cxx/tree/binary/cdr/test.xsd
new file mode 100644
index 0000000..0629e94
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/cdr/test.xsd
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:t="test"
+ targetNamespace="test">
+
+ <simpleType name="list">
+ <list itemType="int"/>
+ </simpleType>
+
+ <simpleType name="union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <simpleType name="enumeration">
+ <restriction base="string">
+ <enumeration value="top"/>
+ <enumeration value="left"/>
+ <enumeration value="bottom"/>
+ <enumeration value="right"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="x" type="int" use="required"/>
+ </complexType>
+
+ <complexType name="complex">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="y" type="int"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+
+ <complexType name="type">
+ <sequence>
+ <element name="list" type="t:list"/>
+ <element name="union" type="t:union"/>
+ <element name="enumeration" type="t:enumeration"/>
+ <element name="complex" type="t:complex" maxOccurs="unbounded"/>
+
+ <!-- integers -->
+ <element name="byte" type="byte"/>
+ <element name="unsigned_byte" type="unsignedByte"/>
+ <element name="short" type="short"/>
+ <element name="unsigned_short" type="unsignedShort"/>
+ <element name="int" type="int"/>
+ <element name="unsigned_int" type="unsignedInt"/>
+ <element name="long" type="long"/>
+ <element name="unsigned_long" type="unsignedLong"/>
+ <element name="integer" type="integer"/>
+ <element name="non_positive_integer" type="nonPositiveInteger"/>
+ <element name="non_negative_integer" type="nonNegativeInteger"/>
+ <element name="positive_integer" type="positiveInteger"/>
+ <element name="negative_integer" type="negativeInteger"/>
+
+
+ <!-- boolean -->
+ <element name="boolean" type="boolean"/>
+
+
+ <!-- floats -->
+ <element name="float" type="float"/>
+ <element name="double" type="double"/>
+ <element name="decimal" type="decimal"/>
+
+
+ <!-- strings -->
+ <element name="string" type="string"/>
+ <element name="normalized_string" type="normalizedString"/>
+ <element name="token" type="token"/>
+ <element name="name" type="Name"/>
+ <element name="name_token" type="NMTOKEN"/>
+ <element name="name_tokens" type="NMTOKENS"/>
+ <element name="ncname" type="NCName"/>
+ <element name="language" type="language"/>
+
+ <!-- qualified name -->
+ <element name="qname" type="QName"/>
+
+
+ <!-- ID/IDREF -->
+ <element name="id" maxOccurs="2" type="ID"/>
+ <element name="id_ref" type="IDREF"/>
+ <element name="id_refs" type="IDREFS"/>
+
+
+ <!-- URI -->
+ <element name="any_uri" type="anyURI"/>
+
+
+ <!-- binary -->
+ <element name="base64_binary" type="base64Binary"/>
+ <element name="hex_binary" type="hexBinary"/>
+
+
+ <!-- date/time -->
+ <element name="date" type="date"/>
+ <element name="date_time" type="dateTime"/>
+ <element name="duration" type="duration"/>
+ <element name="day" type="gDay"/>
+ <element name="month" type="gMonth"/>
+ <element name="month_day" type="gMonthDay"/>
+ <element name="year" type="gYear"/>
+ <element name="year_month" type="gYearMonth"/>
+ <element name="time" type="time"/>
+
+ <element name="any_simple_type" type="anySimpleType"/>
+ </sequence>
+ <attribute name="any_simple_type_attr" type="anySimpleType" use="required"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/binary/polymorphic/buildfile b/xsd-tests/cxx/tree/binary/polymorphic/buildfile
new file mode 100644
index 0000000..d34ef27
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/polymorphic/buildfile
@@ -0,0 +1,27 @@
+# file : cxx/tree/binary/polymorphic/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+import libs += libace%lib{ACE}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-polymorphic \
+ --root-element-last \
+ --generate-insertion 'ACE_OutputCDR' \
+ --generate-extraction 'ACE_InputCDR' \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/binary/polymorphic/driver.cxx b/xsd-tests/cxx/tree/binary/polymorphic/driver.cxx
new file mode 100644
index 0000000..15ebf17
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/polymorphic/driver.cxx
@@ -0,0 +1,164 @@
+// file : tests/cxx/tree/binary/polymorphic/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test polymorphic binary serialization.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+#include <iostream>
+#include <typeinfo>
+
+#include <ace/Log_Msg.h> // ACE_HEX_DUMP
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ // Save to a CDR stream.
+ //
+ ACE_OutputCDR ace_ocdr;
+ xml_schema::ostream<ACE_OutputCDR> ocdr (ace_ocdr);
+ ocdr << *r;
+
+ /*
+ // Print the binary representation.
+ //
+ cerr << "binary representation size: " << ace_ocdr.total_length () << endl;
+
+ for (const ACE_Message_Block* mb = ace_ocdr.begin ();
+ mb != 0;
+ mb = mb->cont ())
+ {
+ ACE_HEX_DUMP ((LM_DEBUG, mb->rd_ptr (), mb->length ()));
+ }
+ */
+
+ // Load from a CDR stream.
+ //
+ ACE_InputCDR ace_icdr (ace_ocdr);
+ xml_schema::istream<ACE_InputCDR> icdr (ace_icdr);
+ XSD_AUTO_PTR<type> c (new type (icdr));
+
+ // Compare the two.
+ //
+ assert (r->list () == c->list ());
+ assert (r->union_ () == c->union_ ());
+ assert (r->enumeration () == c->enumeration ());
+
+ {
+ complex& rc (dynamic_cast<complex&> (r->base ()));
+ complex& cc (dynamic_cast<complex&> (c->base ()));
+
+ assert (rc.a () == cc.a ());
+ if (rc.b ())
+ assert (rc.b () == cc.b ());
+ assert (rc.c () == cc.c ());
+
+ assert (rc.x () == cc.x ());
+ if (rc.y ())
+ assert (rc.y () == cc.y ());
+ }
+
+ {
+ complex& rc (dynamic_cast<complex&> (r->sbase ()));
+ complex& cc (dynamic_cast<complex&> (c->sbase ()));
+
+ assert (rc.a () == cc.a ());
+ if (rc.b ())
+ assert (rc.b () == cc.b ());
+ assert (rc.c () == cc.c ());
+
+ assert (rc.x () == cc.x ());
+ if (rc.y ())
+ assert (rc.y () == cc.y ());
+ }
+
+ // integers
+ //
+ assert (r->byte () == c->byte ());
+ assert (r->unsigned_byte () == c->unsigned_byte ());
+ assert (r->short_ () == c->short_ ());
+ assert (r->unsigned_short () == c->unsigned_short ());
+ assert (r->int_ () == c->int_ ());
+ assert (r->unsigned_int () == c->unsigned_int ());
+ assert (r->long_ () == c->long_ ());
+ assert (r->unsigned_long () == c->unsigned_long ());
+ assert (r->integer () == c->integer ());
+ assert (r->non_positive_integer () == c->non_positive_integer ());
+ assert (r->non_negative_integer () == c->non_negative_integer ());
+ assert (r->positive_integer () == c->positive_integer ());
+ assert (r->negative_integer () == c->negative_integer ());
+
+ // boolean
+ //
+ assert (r->boolean () == c->boolean ());
+
+ // floats
+ //
+ assert (r->float_ () == c->float_ ());
+ assert (r->double_ () == c->double_ ());
+ assert (r->decimal () == c->decimal ());
+
+ // strings
+ //
+ assert (r->string () == c->string ());
+ assert (r->normalized_string () == c->normalized_string ());
+ assert (r->token () == c->token ());
+ assert (r->name () == c->name ());
+ assert (r->name_token () == c->name_token ());
+ assert (r->name_tokens () == c->name_tokens ());
+ assert (r->ncname () == c->ncname ());
+ assert (r->language () == c->language ());
+
+ // qualified name
+ //
+ assert (r->qname () == c->qname ());
+
+ // ID/IDREF
+ //
+ assert (r->id () == c->id ());
+ assert (r->id_ref () == c->id_ref ());
+ assert (r->id_refs () == c->id_refs ());
+
+ // URI
+ //
+ assert (r->any_uri () == c->any_uri ());
+
+ // binary
+ //
+ assert (r->base64_binary () == c->base64_binary ());
+ assert (r->hex_binary () == c->hex_binary ());
+
+ // date/time
+ //
+ assert (r->date () == c->date ());
+ assert (r->date_time () == c->date_time ());
+ assert (r->duration () == c->duration ());
+ assert (r->day () == c->day ());
+ assert (r->month () == c->month ());
+ assert (r->month_day () == c->month_day ());
+ assert (r->year () == c->year ());
+ assert (r->year_month () == c->year_month ());
+ assert (r->time () == c->time ());
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/binary/polymorphic/test.xml b/xsd-tests/cxx/tree/binary/polymorphic/test.xml
new file mode 100644
index 0000000..ad3a403
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/polymorphic/test.xml
@@ -0,0 +1,92 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <list>1 2 3</list>
+
+ <union>abc</union>
+
+ <enumeration>left</enumeration>
+
+ <base x="1" xsi:type="t:complex">
+ <a>aaa</a>
+ </base>
+
+ <t:scomplex x="1" y="2">
+ <a>aaa</a>
+ <b>bbb</b>
+ <c>c</c>
+ <c>cc</c>
+ <c>ccc</c>
+ </t:scomplex>
+
+
+ <!-- integers -->
+ <byte>65</byte>
+ <unsigned_byte>66</unsigned_byte>
+ <short>-222</short>
+ <unsigned_short>57005</unsigned_short>
+ <int>-57005</int>
+ <unsigned_int>3735928559</unsigned_int>
+ <long>-3735928559</long>
+ <unsigned_long>16045690984833335023</unsigned_long>
+ <integer>-3735928559</integer>
+ <non_positive_integer>-3735928559</non_positive_integer>
+ <non_negative_integer>3735928559</non_negative_integer>
+ <positive_integer>3735928559</positive_integer>
+ <negative_integer>-3735928559</negative_integer>
+
+
+ <!-- boolean -->
+ <boolean>true</boolean>
+
+
+ <!-- floats -->
+ <float>1234.1234</float>
+ <double>12345678.12345678</double>
+ <decimal>1234567812345678.1234567812345678</decimal>
+
+
+ <!-- strings -->
+ <string>string</string>
+ <normalized_string>normalized string</normalized_string>
+ <token>one two three</token>
+ <name>name</name>
+ <name_token>name-token</name_token>
+ <name_tokens>name tokens</name_tokens>
+ <ncname>ncname</ncname>
+ <language>en-us</language>
+
+ <!-- qualified name -->
+ <qname>xsi:schemaLocation</qname>
+
+
+ <!-- ID/IDREF -->
+ <id>elements1</id>
+ <id>elements2</id>
+ <id_ref>elements1</id_ref>
+ <id_refs>elements1 elements2</id_refs>
+
+
+ <!-- URI -->
+ <any_uri>http://www.codesynthesis.com</any_uri>
+
+
+ <!-- binary -->
+ <base64_binary>YmFzZTY0IGJpbmFyeQ==</base64_binary>
+ <hex_binary>6865782052696E617279</hex_binary>
+
+
+ <!-- date/time -->
+ <date>2001-10-26+02:00</date>
+ <date_time>2001-10-26T21:32:52+02:00</date_time>
+ <duration>P1Y2M3DT5H20M30S</duration>
+ <day>---01+02:00</day>
+ <month>--11+02:00</month>
+ <month_day>--11-02+02:00</month_day>
+ <year>2001+02:00</year>
+ <year_month>2001-11+02:00</year_month>
+ <time>21:32:52+02:00</time>
+
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/binary/polymorphic/test.xsd b/xsd-tests/cxx/tree/binary/polymorphic/test.xsd
new file mode 100644
index 0000000..8c214e5
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/polymorphic/test.xsd
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:t="test"
+ targetNamespace="test">
+
+ <simpleType name="list">
+ <list itemType="int"/>
+ </simpleType>
+
+ <simpleType name="union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <simpleType name="enumeration">
+ <restriction base="string">
+ <enumeration value="top"/>
+ <enumeration value="left"/>
+ <enumeration value="bottom"/>
+ <enumeration value="right"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="x" type="int" use="required"/>
+ </complexType>
+
+ <element name="sbase" type="t:base"/>
+
+ <complexType name="complex">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="y" type="int"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="scomplex" type="t:complex" substitutionGroup="t:sbase"/>
+
+ <complexType name="type">
+ <sequence>
+ <element name="list" type="t:list"/>
+ <element name="union" type="t:union"/>
+ <element name="enumeration" type="t:enumeration"/>
+
+ <element name="base" type="t:base"/>
+ <element ref="t:sbase"/>
+
+ <!-- integers -->
+ <element name="byte" type="byte"/>
+ <element name="unsigned_byte" type="unsignedByte"/>
+ <element name="short" type="short"/>
+ <element name="unsigned_short" type="unsignedShort"/>
+ <element name="int" type="int"/>
+ <element name="unsigned_int" type="unsignedInt"/>
+ <element name="long" type="long"/>
+ <element name="unsigned_long" type="unsignedLong"/>
+ <element name="integer" type="integer"/>
+ <element name="non_positive_integer" type="nonPositiveInteger"/>
+ <element name="non_negative_integer" type="nonNegativeInteger"/>
+ <element name="positive_integer" type="positiveInteger"/>
+ <element name="negative_integer" type="negativeInteger"/>
+
+
+ <!-- boolean -->
+ <element name="boolean" type="boolean"/>
+
+
+ <!-- floats -->
+ <element name="float" type="float"/>
+ <element name="double" type="double"/>
+ <element name="decimal" type="decimal"/>
+
+
+ <!-- strings -->
+ <element name="string" type="string"/>
+ <element name="normalized_string" type="normalizedString"/>
+ <element name="token" type="token"/>
+ <element name="name" type="Name"/>
+ <element name="name_token" type="NMTOKEN"/>
+ <element name="name_tokens" type="NMTOKENS"/>
+ <element name="ncname" type="NCName"/>
+ <element name="language" type="language"/>
+
+ <!-- qualified name -->
+ <element name="qname" type="QName"/>
+
+
+ <!-- ID/IDREF -->
+ <element name="id" maxOccurs="2" type="ID"/>
+ <element name="id_ref" type="IDREF"/>
+ <element name="id_refs" type="IDREFS"/>
+
+
+ <!-- URI -->
+ <element name="any_uri" type="anyURI"/>
+
+
+ <!-- binary -->
+ <element name="base64_binary" type="base64Binary"/>
+ <element name="hex_binary" type="hexBinary"/>
+
+
+ <!-- date/time -->
+ <element name="date" type="date"/>
+ <element name="date_time" type="dateTime"/>
+ <element name="duration" type="duration"/>
+ <element name="day" type="gDay"/>
+ <element name="month" type="gMonth"/>
+ <element name="month_day" type="gMonthDay"/>
+ <element name="year" type="gYear"/>
+ <element name="year_month" type="gYearMonth"/>
+ <element name="time" type="time"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/buildfile b/xsd-tests/cxx/tree/binary/xdr-ordered/buildfile
new file mode 100644
index 0000000..09414c7
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr-ordered/buildfile
@@ -0,0 +1,28 @@
+# file : cxx/tree/binary/xdr-ordered/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+if ($cxx.target.class == 'linux')
+ import libs += libtirpc%lib{tirpc}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-insertion 'XDR' \
+ --generate-extraction 'XDR' \
+ --generate-comparison \
+ --ordered-type-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx b/xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx
new file mode 100644
index 0000000..d61a645
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr-ordered/driver.cxx
@@ -0,0 +1,206 @@
+// file : tests/cxx/tree/binary/xdr-ordered/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test non-polymorphic ordered binary serialization to XDR.
+//
+// Note: just a copy of xdr test with --ordered-type-all option.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cstring> // std::memcpy
+#include <cassert>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+extern "C" int
+overflow (void* p, char* buf, int in)
+{
+ xml_schema::buffer* dst (reinterpret_cast<xml_schema::buffer*> (p));
+
+ size_t n (static_cast<size_t> (in)), size (dst->size ());
+ dst->size (size + n);
+ memcpy (dst->data () + size, buf, n);
+
+ return static_cast<int> (n);
+}
+
+struct underflow_info
+{
+ xml_schema::buffer* buf;
+ std::size_t pos;
+};
+
+extern "C" int
+underflow (void* p, char* buf, int in)
+{
+ underflow_info* ui (reinterpret_cast<underflow_info*> (p));
+
+ size_t n (static_cast<size_t> (in)), size (ui->buf->size () - ui->pos);
+ n = size > n ? n : size;
+
+ memcpy (buf, ui->buf->data () + ui->pos, n);
+ ui->pos += n;
+
+ return static_cast<int> (n);
+}
+
+// The xdrrec_create function (used below) has slightly different
+// prototypes on different platforms. To make this test portable
+// we will need to cast the actual function to the following common
+// prototype.
+//
+extern "C"
+typedef void (*xdrrec_create_p) (
+ XDR*,
+ unsigned int write_size,
+ unsigned int read_size,
+ void* user_data,
+ int (*read) (void* user_data, char* buf, int n),
+ int (*write) (void* user_data, char* buf, int n));
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ xdrrec_create_p xdrrec_create_ =
+ reinterpret_cast<xdrrec_create_p> (::xdrrec_create);
+
+ // Save to an XDR stream.
+ //
+ XDR xdr;
+ xml_schema::buffer buf;
+ xdrrec_create_ (&xdr, 0, 0, reinterpret_cast<char*> (&buf), 0, &overflow);
+ xdr.x_op = XDR_ENCODE;
+ xsd::cxx::tree::ostream<XDR> oxdr (xdr);
+ oxdr << *r;
+ xdrrec_endofrecord (&xdr, true); // flush the data
+ xdr_destroy (&xdr);
+
+ // Load from an XDR stream.
+ //
+ underflow_info ui;
+ ui.buf = &buf;
+ ui.pos = 0;
+ xdrrec_create_ (&xdr, 0, 0, reinterpret_cast<char*> (&ui), &underflow, 0);
+ xdr.x_op = XDR_DECODE;
+ xdrrec_skiprecord (&xdr);
+ xsd::cxx::tree::istream<XDR> ixdr (xdr);
+ XSD_AUTO_PTR<type> c (new type (ixdr));
+ xdr_destroy (&xdr);
+
+ // Compare the two.
+ //
+ assert (r->list () == c->list ());
+ assert (r->union_ () == c->union_ ());
+ assert (r->enumeration () == c->enumeration ());
+
+ type::complex_sequence rs (r->complex ()), cs (c->complex ());
+
+ for (type::complex_iterator ri (rs.begin ()), ci (cs.begin ());
+ ri != rs.end () && ci != rs.end (); ++ri, ++ci)
+ {
+ assert (ri->a () == ci->a ());
+ if (ri->b ())
+ assert (ri->b () == ci->b ());
+ assert (ri->c () == ci->c ());
+
+ assert (ri->x () == ci->x ());
+ if (ri->y ())
+ assert (ri->y () == ci->y ());
+ }
+
+ // integers
+ //
+ assert (r->byte () == c->byte ());
+ assert (r->unsigned_byte () == c->unsigned_byte ());
+ assert (r->short_ () == c->short_ ());
+ assert (r->unsigned_short () == c->unsigned_short ());
+ assert (r->int_ () == c->int_ ());
+ assert (r->unsigned_int () == c->unsigned_int ());
+ assert (r->long_ () == c->long_ ());
+ assert (r->unsigned_long () == c->unsigned_long ());
+ assert (r->integer () == c->integer ());
+ assert (r->non_positive_integer () == c->non_positive_integer ());
+ assert (r->non_negative_integer () == c->non_negative_integer ());
+ assert (r->positive_integer () == c->positive_integer ());
+ assert (r->negative_integer () == c->negative_integer ());
+
+ // boolean
+ //
+ assert (r->boolean () == c->boolean ());
+
+ // floats
+ //
+ assert (r->float_ () == c->float_ ());
+ assert (r->double_ () == c->double_ ());
+ assert (r->decimal () == c->decimal ());
+
+ // strings
+ //
+ assert (r->string () == c->string ());
+ assert (r->normalized_string () == c->normalized_string ());
+ assert (r->token () == c->token ());
+ assert (r->name () == c->name ());
+ assert (r->name_token () == c->name_token ());
+ assert (r->name_tokens () == c->name_tokens ());
+ assert (r->ncname () == c->ncname ());
+ assert (r->language () == c->language ());
+
+ // qualified name
+ //
+ assert (r->qname () == c->qname ());
+
+ // ID/IDREF
+ //
+ assert (r->id () == c->id ());
+ assert (r->id_ref () == c->id_ref ());
+ assert (r->id_refs () == c->id_refs ());
+
+ // URI
+ //
+ assert (r->any_uri () == c->any_uri ());
+
+ // binary
+ //
+ assert (r->base64_binary () == c->base64_binary ());
+ assert (r->hex_binary () == c->hex_binary ());
+
+ // date/time
+ //
+ assert (r->date () == c->date ());
+ assert (r->date_time () == c->date_time ());
+ assert (r->duration () == c->duration ());
+ assert (r->day () == c->day ());
+ assert (r->month () == c->month ());
+ assert (r->month_day () == c->month_day ());
+ assert (r->year () == c->year ());
+ assert (r->year_month () == c->year_month ());
+ assert (r->time () == c->time ());
+
+ // anySimpleType
+ //
+ assert (!r->any_simple_type_attr ().text_content ().empty ());
+ assert (r->any_simple_type_attr () == c->any_simple_type_attr ());
+
+ assert (!r->any_simple_type ().text_content ().empty ());
+ assert (r->any_simple_type () == c->any_simple_type ());
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/test.xml b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xml
new file mode 100644
index 0000000..5cedd98
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xml
@@ -0,0 +1,93 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+ any_simple_type_attr="any simple content">
+
+ <list>1 2 3</list>
+
+ <union>abc</union>
+
+ <enumeration>left</enumeration>
+
+ <complex x="1">
+ <a>aaa</a>
+ </complex>
+ <complex x="1" y="2">
+ <a>aaa</a>
+ <b>bbb</b>
+ <c>c</c>
+ <c>cc</c>
+ <c>ccc</c>
+ </complex>
+
+
+ <!-- integers -->
+ <byte>65</byte>
+ <unsigned_byte>66</unsigned_byte>
+ <short>-222</short>
+ <unsigned_short>57005</unsigned_short>
+ <int>-57005</int>
+ <unsigned_int>3735928559</unsigned_int>
+ <long>-3735928559</long>
+ <unsigned_long>16045690984833335023</unsigned_long>
+ <integer>-3735928559</integer>
+ <non_positive_integer>-3735928559</non_positive_integer>
+ <non_negative_integer>3735928559</non_negative_integer>
+ <positive_integer>3735928559</positive_integer>
+ <negative_integer>-3735928559</negative_integer>
+
+
+ <!-- boolean -->
+ <boolean>true</boolean>
+
+
+ <!-- floats -->
+ <float>1234.1234</float>
+ <double>12345678.12345678</double>
+ <decimal>1234567812345678.1234567812345678</decimal>
+
+
+ <!-- strings -->
+ <string>string</string>
+ <normalized_string>normalized string</normalized_string>
+ <token>one two three</token>
+ <name>name</name>
+ <name_token>name-token</name_token>
+ <name_tokens>name tokens</name_tokens>
+ <ncname>ncname</ncname>
+ <language>en-us</language>
+
+ <!-- qualified name -->
+ <qname>xsi:schemaLocation</qname>
+
+
+ <!-- ID/IDREF -->
+ <id>elements1</id>
+ <id>elements2</id>
+ <id_ref>elements1</id_ref>
+ <id_refs>elements1 elements2</id_refs>
+
+
+ <!-- URI -->
+ <any_uri>http://www.codesynthesis.com</any_uri>
+
+
+ <!-- binary -->
+ <base64_binary>YmFzZTY0IGJpbmFyeQ==</base64_binary>
+ <hex_binary>6865782052696E617279</hex_binary>
+
+
+ <!-- date/time -->
+ <date>2001-10-26+02:00</date>
+ <date_time>2001-10-26T21:32:52+02:00</date_time>
+ <duration>P1Y2M3DT5H20M30S</duration>
+ <day>---01+02:00</day>
+ <month>--11+02:00</month>
+ <month_day>--11-02+02:00</month_day>
+ <year>2001+02:00</year>
+ <year_month>2001-11+02:00</year_month>
+ <time>21:32:52+02:00</time>
+
+ <any_simple_type>any simple content in element</any_simple_type>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd
new file mode 100644
index 0000000..0629e94
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr-ordered/test.xsd
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:t="test"
+ targetNamespace="test">
+
+ <simpleType name="list">
+ <list itemType="int"/>
+ </simpleType>
+
+ <simpleType name="union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <simpleType name="enumeration">
+ <restriction base="string">
+ <enumeration value="top"/>
+ <enumeration value="left"/>
+ <enumeration value="bottom"/>
+ <enumeration value="right"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="x" type="int" use="required"/>
+ </complexType>
+
+ <complexType name="complex">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="y" type="int"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+
+ <complexType name="type">
+ <sequence>
+ <element name="list" type="t:list"/>
+ <element name="union" type="t:union"/>
+ <element name="enumeration" type="t:enumeration"/>
+ <element name="complex" type="t:complex" maxOccurs="unbounded"/>
+
+ <!-- integers -->
+ <element name="byte" type="byte"/>
+ <element name="unsigned_byte" type="unsignedByte"/>
+ <element name="short" type="short"/>
+ <element name="unsigned_short" type="unsignedShort"/>
+ <element name="int" type="int"/>
+ <element name="unsigned_int" type="unsignedInt"/>
+ <element name="long" type="long"/>
+ <element name="unsigned_long" type="unsignedLong"/>
+ <element name="integer" type="integer"/>
+ <element name="non_positive_integer" type="nonPositiveInteger"/>
+ <element name="non_negative_integer" type="nonNegativeInteger"/>
+ <element name="positive_integer" type="positiveInteger"/>
+ <element name="negative_integer" type="negativeInteger"/>
+
+
+ <!-- boolean -->
+ <element name="boolean" type="boolean"/>
+
+
+ <!-- floats -->
+ <element name="float" type="float"/>
+ <element name="double" type="double"/>
+ <element name="decimal" type="decimal"/>
+
+
+ <!-- strings -->
+ <element name="string" type="string"/>
+ <element name="normalized_string" type="normalizedString"/>
+ <element name="token" type="token"/>
+ <element name="name" type="Name"/>
+ <element name="name_token" type="NMTOKEN"/>
+ <element name="name_tokens" type="NMTOKENS"/>
+ <element name="ncname" type="NCName"/>
+ <element name="language" type="language"/>
+
+ <!-- qualified name -->
+ <element name="qname" type="QName"/>
+
+
+ <!-- ID/IDREF -->
+ <element name="id" maxOccurs="2" type="ID"/>
+ <element name="id_ref" type="IDREF"/>
+ <element name="id_refs" type="IDREFS"/>
+
+
+ <!-- URI -->
+ <element name="any_uri" type="anyURI"/>
+
+
+ <!-- binary -->
+ <element name="base64_binary" type="base64Binary"/>
+ <element name="hex_binary" type="hexBinary"/>
+
+
+ <!-- date/time -->
+ <element name="date" type="date"/>
+ <element name="date_time" type="dateTime"/>
+ <element name="duration" type="duration"/>
+ <element name="day" type="gDay"/>
+ <element name="month" type="gMonth"/>
+ <element name="month_day" type="gMonthDay"/>
+ <element name="year" type="gYear"/>
+ <element name="year_month" type="gYearMonth"/>
+ <element name="time" type="time"/>
+
+ <element name="any_simple_type" type="anySimpleType"/>
+ </sequence>
+ <attribute name="any_simple_type_attr" type="anySimpleType" use="required"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/binary/xdr/buildfile b/xsd-tests/cxx/tree/binary/xdr/buildfile
new file mode 100644
index 0000000..b8fc2f4
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr/buildfile
@@ -0,0 +1,27 @@
+# file : cxx/tree/binary/xdr/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+if ($cxx.target.class == 'linux')
+ import libs += libtirpc%lib{tirpc}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-insertion 'XDR' \
+ --generate-extraction 'XDR' \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/binary/xdr/driver.cxx b/xsd-tests/cxx/tree/binary/xdr/driver.cxx
new file mode 100644
index 0000000..04606ea
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr/driver.cxx
@@ -0,0 +1,204 @@
+// file : tests/cxx/tree/binary/xdr/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test non-polymorphic binary serialization to XDR.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cstring> // std::memcpy
+#include <cassert>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+extern "C" int
+overflow (void* p, char* buf, int in)
+{
+ xml_schema::buffer* dst (reinterpret_cast<xml_schema::buffer*> (p));
+
+ size_t n (static_cast<size_t> (in)), size (dst->size ());
+ dst->size (size + n);
+ memcpy (dst->data () + size, buf, n);
+
+ return static_cast<int> (n);
+}
+
+struct underflow_info
+{
+ xml_schema::buffer* buf;
+ std::size_t pos;
+};
+
+extern "C" int
+underflow (void* p, char* buf, int in)
+{
+ underflow_info* ui (reinterpret_cast<underflow_info*> (p));
+
+ size_t n (static_cast<size_t> (in)), size (ui->buf->size () - ui->pos);
+ n = size > n ? n : size;
+
+ memcpy (buf, ui->buf->data () + ui->pos, n);
+ ui->pos += n;
+
+ return static_cast<int> (n);
+}
+
+// The xdrrec_create function (used below) has slightly different
+// prototypes on different platforms. To make this test portable
+// we will need to cast the actual function to the following common
+// prototype.
+//
+extern "C"
+typedef void (*xdrrec_create_p) (
+ XDR*,
+ unsigned int write_size,
+ unsigned int read_size,
+ void* user_data,
+ int (*read) (void* user_data, char* buf, int n),
+ int (*write) (void* user_data, char* buf, int n));
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ xdrrec_create_p xdrrec_create_ =
+ reinterpret_cast<xdrrec_create_p> (::xdrrec_create);
+
+ // Save to an XDR stream.
+ //
+ XDR xdr;
+ xml_schema::buffer buf;
+ xdrrec_create_ (&xdr, 0, 0, reinterpret_cast<char*> (&buf), 0, &overflow);
+ xdr.x_op = XDR_ENCODE;
+ xsd::cxx::tree::ostream<XDR> oxdr (xdr);
+ oxdr << *r;
+ xdrrec_endofrecord (&xdr, true); // flush the data
+ xdr_destroy (&xdr);
+
+ // Load from an XDR stream.
+ //
+ underflow_info ui;
+ ui.buf = &buf;
+ ui.pos = 0;
+ xdrrec_create_ (&xdr, 0, 0, reinterpret_cast<char*> (&ui), &underflow, 0);
+ xdr.x_op = XDR_DECODE;
+ xdrrec_skiprecord (&xdr);
+ xsd::cxx::tree::istream<XDR> ixdr (xdr);
+ XSD_AUTO_PTR<type> c (new type (ixdr));
+ xdr_destroy (&xdr);
+
+ // Compare the two.
+ //
+ assert (r->list () == c->list ());
+ assert (r->union_ () == c->union_ ());
+ assert (r->enumeration () == c->enumeration ());
+
+ type::complex_sequence rs (r->complex ()), cs (c->complex ());
+
+ for (type::complex_iterator ri (rs.begin ()), ci (cs.begin ());
+ ri != rs.end () && ci != rs.end (); ++ri, ++ci)
+ {
+ assert (ri->a () == ci->a ());
+ if (ri->b ())
+ assert (ri->b () == ci->b ());
+ assert (ri->c () == ci->c ());
+
+ assert (ri->x () == ci->x ());
+ if (ri->y ())
+ assert (ri->y () == ci->y ());
+ }
+
+ // integers
+ //
+ assert (r->byte () == c->byte ());
+ assert (r->unsigned_byte () == c->unsigned_byte ());
+ assert (r->short_ () == c->short_ ());
+ assert (r->unsigned_short () == c->unsigned_short ());
+ assert (r->int_ () == c->int_ ());
+ assert (r->unsigned_int () == c->unsigned_int ());
+ assert (r->long_ () == c->long_ ());
+ assert (r->unsigned_long () == c->unsigned_long ());
+ assert (r->integer () == c->integer ());
+ assert (r->non_positive_integer () == c->non_positive_integer ());
+ assert (r->non_negative_integer () == c->non_negative_integer ());
+ assert (r->positive_integer () == c->positive_integer ());
+ assert (r->negative_integer () == c->negative_integer ());
+
+ // boolean
+ //
+ assert (r->boolean () == c->boolean ());
+
+ // floats
+ //
+ assert (r->float_ () == c->float_ ());
+ assert (r->double_ () == c->double_ ());
+ assert (r->decimal () == c->decimal ());
+
+ // strings
+ //
+ assert (r->string () == c->string ());
+ assert (r->normalized_string () == c->normalized_string ());
+ assert (r->token () == c->token ());
+ assert (r->name () == c->name ());
+ assert (r->name_token () == c->name_token ());
+ assert (r->name_tokens () == c->name_tokens ());
+ assert (r->ncname () == c->ncname ());
+ assert (r->language () == c->language ());
+
+ // qualified name
+ //
+ assert (r->qname () == c->qname ());
+
+ // ID/IDREF
+ //
+ assert (r->id () == c->id ());
+ assert (r->id_ref () == c->id_ref ());
+ assert (r->id_refs () == c->id_refs ());
+
+ // URI
+ //
+ assert (r->any_uri () == c->any_uri ());
+
+ // binary
+ //
+ assert (r->base64_binary () == c->base64_binary ());
+ assert (r->hex_binary () == c->hex_binary ());
+
+ // date/time
+ //
+ assert (r->date () == c->date ());
+ assert (r->date_time () == c->date_time ());
+ assert (r->duration () == c->duration ());
+ assert (r->day () == c->day ());
+ assert (r->month () == c->month ());
+ assert (r->month_day () == c->month_day ());
+ assert (r->year () == c->year ());
+ assert (r->year_month () == c->year_month ());
+ assert (r->time () == c->time ());
+
+ // anySimpleType
+ //
+ assert (!r->any_simple_type_attr ().text_content ().empty ());
+ assert (r->any_simple_type_attr () == c->any_simple_type_attr ());
+
+ assert (!r->any_simple_type ().text_content ().empty ());
+ assert (r->any_simple_type () == c->any_simple_type ());
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/binary/xdr/test.xml b/xsd-tests/cxx/tree/binary/xdr/test.xml
new file mode 100644
index 0000000..5cedd98
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr/test.xml
@@ -0,0 +1,93 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+ any_simple_type_attr="any simple content">
+
+ <list>1 2 3</list>
+
+ <union>abc</union>
+
+ <enumeration>left</enumeration>
+
+ <complex x="1">
+ <a>aaa</a>
+ </complex>
+ <complex x="1" y="2">
+ <a>aaa</a>
+ <b>bbb</b>
+ <c>c</c>
+ <c>cc</c>
+ <c>ccc</c>
+ </complex>
+
+
+ <!-- integers -->
+ <byte>65</byte>
+ <unsigned_byte>66</unsigned_byte>
+ <short>-222</short>
+ <unsigned_short>57005</unsigned_short>
+ <int>-57005</int>
+ <unsigned_int>3735928559</unsigned_int>
+ <long>-3735928559</long>
+ <unsigned_long>16045690984833335023</unsigned_long>
+ <integer>-3735928559</integer>
+ <non_positive_integer>-3735928559</non_positive_integer>
+ <non_negative_integer>3735928559</non_negative_integer>
+ <positive_integer>3735928559</positive_integer>
+ <negative_integer>-3735928559</negative_integer>
+
+
+ <!-- boolean -->
+ <boolean>true</boolean>
+
+
+ <!-- floats -->
+ <float>1234.1234</float>
+ <double>12345678.12345678</double>
+ <decimal>1234567812345678.1234567812345678</decimal>
+
+
+ <!-- strings -->
+ <string>string</string>
+ <normalized_string>normalized string</normalized_string>
+ <token>one two three</token>
+ <name>name</name>
+ <name_token>name-token</name_token>
+ <name_tokens>name tokens</name_tokens>
+ <ncname>ncname</ncname>
+ <language>en-us</language>
+
+ <!-- qualified name -->
+ <qname>xsi:schemaLocation</qname>
+
+
+ <!-- ID/IDREF -->
+ <id>elements1</id>
+ <id>elements2</id>
+ <id_ref>elements1</id_ref>
+ <id_refs>elements1 elements2</id_refs>
+
+
+ <!-- URI -->
+ <any_uri>http://www.codesynthesis.com</any_uri>
+
+
+ <!-- binary -->
+ <base64_binary>YmFzZTY0IGJpbmFyeQ==</base64_binary>
+ <hex_binary>6865782052696E617279</hex_binary>
+
+
+ <!-- date/time -->
+ <date>2001-10-26+02:00</date>
+ <date_time>2001-10-26T21:32:52+02:00</date_time>
+ <duration>P1Y2M3DT5H20M30S</duration>
+ <day>---01+02:00</day>
+ <month>--11+02:00</month>
+ <month_day>--11-02+02:00</month_day>
+ <year>2001+02:00</year>
+ <year_month>2001-11+02:00</year_month>
+ <time>21:32:52+02:00</time>
+
+ <any_simple_type>any simple content in element</any_simple_type>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/binary/xdr/test.xsd b/xsd-tests/cxx/tree/binary/xdr/test.xsd
new file mode 100644
index 0000000..0629e94
--- /dev/null
+++ b/xsd-tests/cxx/tree/binary/xdr/test.xsd
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:t="test"
+ targetNamespace="test">
+
+ <simpleType name="list">
+ <list itemType="int"/>
+ </simpleType>
+
+ <simpleType name="union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <simpleType name="enumeration">
+ <restriction base="string">
+ <enumeration value="top"/>
+ <enumeration value="left"/>
+ <enumeration value="bottom"/>
+ <enumeration value="right"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="x" type="int" use="required"/>
+ </complexType>
+
+ <complexType name="complex">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="y" type="int"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+
+ <complexType name="type">
+ <sequence>
+ <element name="list" type="t:list"/>
+ <element name="union" type="t:union"/>
+ <element name="enumeration" type="t:enumeration"/>
+ <element name="complex" type="t:complex" maxOccurs="unbounded"/>
+
+ <!-- integers -->
+ <element name="byte" type="byte"/>
+ <element name="unsigned_byte" type="unsignedByte"/>
+ <element name="short" type="short"/>
+ <element name="unsigned_short" type="unsignedShort"/>
+ <element name="int" type="int"/>
+ <element name="unsigned_int" type="unsignedInt"/>
+ <element name="long" type="long"/>
+ <element name="unsigned_long" type="unsignedLong"/>
+ <element name="integer" type="integer"/>
+ <element name="non_positive_integer" type="nonPositiveInteger"/>
+ <element name="non_negative_integer" type="nonNegativeInteger"/>
+ <element name="positive_integer" type="positiveInteger"/>
+ <element name="negative_integer" type="negativeInteger"/>
+
+
+ <!-- boolean -->
+ <element name="boolean" type="boolean"/>
+
+
+ <!-- floats -->
+ <element name="float" type="float"/>
+ <element name="double" type="double"/>
+ <element name="decimal" type="decimal"/>
+
+
+ <!-- strings -->
+ <element name="string" type="string"/>
+ <element name="normalized_string" type="normalizedString"/>
+ <element name="token" type="token"/>
+ <element name="name" type="Name"/>
+ <element name="name_token" type="NMTOKEN"/>
+ <element name="name_tokens" type="NMTOKENS"/>
+ <element name="ncname" type="NCName"/>
+ <element name="language" type="language"/>
+
+ <!-- qualified name -->
+ <element name="qname" type="QName"/>
+
+
+ <!-- ID/IDREF -->
+ <element name="id" maxOccurs="2" type="ID"/>
+ <element name="id_ref" type="IDREF"/>
+ <element name="id_refs" type="IDREFS"/>
+
+
+ <!-- URI -->
+ <element name="any_uri" type="anyURI"/>
+
+
+ <!-- binary -->
+ <element name="base64_binary" type="base64Binary"/>
+ <element name="hex_binary" type="hexBinary"/>
+
+
+ <!-- date/time -->
+ <element name="date" type="date"/>
+ <element name="date_time" type="dateTime"/>
+ <element name="duration" type="duration"/>
+ <element name="day" type="gDay"/>
+ <element name="month" type="gMonth"/>
+ <element name="month_day" type="gMonthDay"/>
+ <element name="year" type="gYear"/>
+ <element name="year_month" type="gYearMonth"/>
+ <element name="time" type="time"/>
+
+ <element name="any_simple_type" type="anySimpleType"/>
+ </sequence>
+ <attribute name="any_simple_type_attr" type="anySimpleType" use="required"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/buildfile b/xsd-tests/cxx/tree/buildfile
new file mode 100644
index 0000000..cfaf0bd
--- /dev/null
+++ b/xsd-tests/cxx/tree/buildfile
@@ -0,0 +1,6 @@
+# file : cxx/tree/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Exclude tests which depend on not yet packaged libraries.
+#
+./: {*/ -binary/}
diff --git a/xsd-tests/cxx/tree/built-in/.gitignore b/xsd-tests/cxx/tree/built-in/.gitignore
new file mode 100644
index 0000000..f86b7a2
--- /dev/null
+++ b/xsd-tests/cxx/tree/built-in/.gitignore
@@ -0,0 +1 @@
+types.?xx
diff --git a/xsd-tests/cxx/tree/built-in/buildfile b/xsd-tests/cxx/tree/built-in/buildfile
new file mode 100644
index 0000000..8ee8585
--- /dev/null
+++ b/xsd-tests/cxx/tree/built-in/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/build-in/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -types} {hxx ixx cxx}{types} $libs testscript
+
+<{hxx ixx cxx}{types}>: xsd{types} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-ostream \
+ --generate-serialization \
+ --char-type char \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/built-in/driver.cxx b/xsd-tests/cxx/tree/built-in/driver.cxx
new file mode 100644
index 0000000..4141290
--- /dev/null
+++ b/xsd-tests/cxx/tree/built-in/driver.cxx
@@ -0,0 +1,93 @@
+// file : cxx/tree/built-in/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test built-in type mapping.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <sstream>
+#include <iostream>
+
+
+#include "types.hxx"
+
+using std::cerr;
+using std::endl;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 4)
+ {
+ cerr << "usage: " << argv[0] << " elements.xml attributes.xml inherited.xml" << endl;
+ return 1;
+ }
+
+ XSD_AUTO_PTR<xmlns::test::Elements> elements (
+ xmlns::test::elements (argv[1]));
+
+ XSD_AUTO_PTR<xmlns::test::Attributes> attributes (
+ xmlns::test::attributes (argv[2]));
+
+ XSD_AUTO_PTR<xmlns::test::Inherited> inherited (
+ xmlns::test::inherited (argv[3]));
+
+ cerr << "elements:" << *elements << endl
+ << endl
+ << "attributes:" << *attributes << endl
+ << endl
+ << "inherited:" << *inherited << endl;
+
+ // Test parsing/serialization.
+ //
+
+ xml_schema::namespace_infomap map;
+
+ map["test"].name = "http://www.codesynthesis.com/xmlns/test";
+ map["test"].schema = "types.xsd";
+
+ {
+ std::ostringstream ostr;
+ xmlns::test::elements (ostr, *elements, map);
+
+ std::istringstream istr (ostr.str ());
+ XSD_AUTO_PTR<xmlns::test::Elements> elements1 (
+ xmlns::test::elements (istr));
+
+ std::ostringstream ostr1;
+ xmlns::test::elements (ostr1, *elements1, map);
+
+ if (ostr.str () != ostr1.str ())
+ return 1;
+ }
+
+ {
+ std::ostringstream ostr;
+ xmlns::test::attributes (ostr, *attributes, map);
+
+ std::istringstream istr (ostr.str ());
+ XSD_AUTO_PTR<xmlns::test::Attributes> attributes1 (
+ xmlns::test::attributes (istr));
+
+ std::ostringstream ostr1;
+ xmlns::test::attributes (ostr1, *attributes1, map);
+
+ if (ostr.str () != ostr1.str ())
+ return 1;
+ }
+
+ {
+ std::ostringstream ostr;
+ xmlns::test::inherited (ostr, *inherited, map);
+
+ std::istringstream istr (ostr.str ());
+ XSD_AUTO_PTR<xmlns::test::Inherited> inherited1 (
+ xmlns::test::inherited (istr));
+
+ std::ostringstream ostr1;
+ xmlns::test::inherited (ostr1, *inherited1, map);
+
+ if (ostr.str () != ostr1.str ())
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/built-in/testscript b/xsd-tests/cxx/tree/built-in/testscript
new file mode 100644
index 0000000..4dae039
--- /dev/null
+++ b/xsd-tests/cxx/tree/built-in/testscript
@@ -0,0 +1,394 @@
+# file : cxx/tree/any-type/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+: types
+:
+{
+ cat <<EOI >=elements.xml;
+ <?xml version="1.0" encoding="UTF-8"?>
+ <test:elements
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.codesynthesis.com/xmlns/test types.xsd">
+
+ <!-- integers -->
+ <byte>65</byte>
+ <unsigned_byte>66</unsigned_byte>
+ <short>-222</short>
+ <unsigned_short>57005</unsigned_short>
+ <int>-57005</int>
+ <unsigned_int>3735928559</unsigned_int>
+ <long>-3735928559</long>
+ <unsigned_long>16045690984833335023</unsigned_long>
+ <integer>-3735928559</integer>
+ <non_positive_integer>-3735928559</non_positive_integer>
+ <non_negative_integer>3735928559</non_negative_integer>
+ <positive_integer>3735928559</positive_integer>
+ <negative_integer>-3735928559</negative_integer>
+
+
+ <!-- boolean -->
+ <boolean>true</boolean>
+
+
+ <!-- floats -->
+ <float>1234.1234</float>
+ <double>12345678.12345678</double>
+ <decimal>12345678.12345678</decimal>
+
+
+ <!-- strings -->
+ <string>string</string>
+ <normalized_string>normalized
+ string</normalized_string>
+ <token>
+ one
+ two three </token>
+ <name>name</name>
+ <name_token>name-token</name_token>
+ <name_tokens>name tokens</name_tokens>
+ <ncname>ncname</ncname>
+ <language>en-us</language>
+
+ <!-- qualified name -->
+ <qname>xsi:schemaLocation</qname>
+
+
+ <!-- ID/IDREF -->
+ <id>elements1</id>
+ <id>elements2</id>
+ <id_ref>elements1</id_ref>
+ <id_refs>elements1 elements2</id_refs>
+
+
+ <!-- URI -->
+ <any_uri>http://www.codesynthesis.com</any_uri>
+
+
+ <!-- binary -->
+ <base64_binary>YmFzZTY0IGJpbmFyeQ==</base64_binary>
+ <hex_binary>6865782052696E617279</hex_binary>
+
+
+ <!-- date/time -->
+ <date>2001-10-26+02:00</date>
+ <date_time>2001-10-26T21:32:52+02:00</date_time>
+ <duration>P1Y2M3DT5H20M30S</duration>
+ <day>---01+02:00</day>
+ <month>--11+02:00</month>
+ <month_day>--11-02+02:00</month_day>
+ <year>2001+02:00</year>
+ <year_month>2001-11+02:00</year_month>
+ <time>21:32:52+02:00</time>
+
+
+ <!-- entity -->
+ <!--
+ <entity>foo</entity>
+ <entities>foo bar</entities>
+ -->
+
+ </test:elements>
+ EOI
+
+ cat <<EOI >=attributes.xml;
+ <?xml version="1.0" encoding="UTF-8"?>
+ <test:attributes
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.codesynthesis.com/xmlns/test types.xsd"
+
+
+ byte="65"
+ unsigned_byte="66"
+ short="-222"
+ unsigned_short="57005"
+ int="-57005"
+ unsigned_int="3735928559"
+ long="-3735928559"
+ unsigned_long="16045690984833335023"
+ integer="-3735928559"
+ non_positive_integer="-3735928559"
+ non_negative_integer="3735928559"
+ positive_integer="3735928559"
+ negative_integer="-3735928559"
+
+
+
+ boolean="false"
+
+
+
+ float="1234.1234"
+ double="12345678.12345678"
+ decimal="12345678.12345678"
+
+
+
+ string="string"
+ normalized_string="normalized string"
+ token=" one two three "
+ name="name"
+ name_token="name-token"
+ name_tokens="name tokens"
+ ncname="ncname"
+ language="en-us"
+
+
+ qname="xsi:schemaLocation"
+
+
+
+ id="attributes"
+ id_ref="attributes"
+ id_refs="attributes"
+
+
+
+ any_uri="http://www.codesynthesis.com"
+
+
+
+ base64_binary="YmFzZTY0IGJpbmFyeQ=="
+ hex_binary="6865782052696E617279"
+
+
+
+ date="2001-10-26+02:00"
+ date_time="2001-10-26T21:32:52+02:00"
+ duration="P1Y2M3DT5H20M30S"
+ day="---01+02:00"
+ month="--11+02:00"
+ month_day="--11-02+02:00"
+ year="2001+02:00"
+ year_month="2001-11+02:00"
+ time="21:32:52+02:00"
+
+ />
+ EOI
+
+ cat <<EOI >=inherited.xml;
+ <?xml version="1.0" encoding="UTF-8"?>
+ <test:inherited
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.codesynthesis.com/xmlns/test types.xsd">
+
+ <!-- integers -->
+ <byte>65</byte>
+ <unsigned_byte>66</unsigned_byte>
+ <short>-222</short>
+ <unsigned_short>57005</unsigned_short>
+ <int>-57005</int>
+ <unsigned_int>3735928559</unsigned_int>
+ <long>-3735928559</long>
+ <unsigned_long>16045690984833335023</unsigned_long>
+ <integer>-3735928559</integer>
+ <non_positive_integer>-3735928559</non_positive_integer>
+ <non_negative_integer>3735928559</non_negative_integer>
+ <positive_integer>3735928559</positive_integer>
+ <negative_integer>-3735928559</negative_integer>
+
+
+ <!-- boolean -->
+ <boolean>true</boolean>
+
+
+ <!-- floats -->
+ <float>1234.1234</float>
+ <double>12345678.12345678</double>
+ <decimal>12345678.12345678</decimal>
+
+
+ <!-- strings -->
+ <string>string</string>
+ <normalized_string>normalized
+ string</normalized_string>
+ <token>
+ one
+ two three </token>
+ <name>name</name>
+ <name_token>name-token</name_token>
+ <name_tokens>name tokens</name_tokens>
+ <ncname>ncname</ncname>
+ <language>en-us</language>
+
+ <!-- qualified name -->
+ <qname>xsi:schemaLocation</qname>
+
+
+ <!-- ID/IDREF -->
+ <id>elements1</id>
+ <id>elements2</id>
+ <id_ref>elements1</id_ref>
+ <id_refs>elements1 elements2</id_refs>
+
+
+ <!-- URI -->
+ <any_uri>http://www.codesynthesis.com</any_uri>
+
+
+ <!-- binary -->
+ <base64_binary>YmFzZTY0IGJpbmFyeQ==</base64_binary>
+ <hex_binary>6865782052696E617279</hex_binary>
+
+
+ <!-- date/time -->
+ <date>2001-10-26+02:00</date>
+ <date_time>2001-10-26T21:32:52+02:00</date_time>
+ <duration>P1Y2M3DT5H20M30S</duration>
+ <day>---01+02:00</day>
+ <month>--11+02:00</month>
+ <month_day>--11-02+02:00</month_day>
+ <year>2001+02:00</year>
+ <year_month>2001-11+02:00</year_month>
+ <time>21:32:52+02:00</time>
+
+
+ <!-- entity -->
+ <!--
+ <entity>foo</entity>
+ <entities>foo bar</entities>
+ -->
+
+ </test:inherited>
+ EOI
+
+ ln -s $src_base/types.xsd ./;
+
+ $* elements.xml attributes.xml inherited.xml 2>>EOE
+ elements:
+ byte: A
+ unsigned_byte: B
+ short: -222
+ unsigned_short: 57005
+ int: -57005
+ unsigned_int: 3735928559
+ long: -3735928559
+ unsigned_long: 16045690984833335023
+ integer: -3735928559
+ non_positive_integer: -3735928559
+ non_negative_integer: 3735928559
+ positive_integer: 3735928559
+ negative_integer: -3735928559
+ boolean: 1
+ float: 1234.12
+ double: 1.23457e+07
+ decimal: 1.23457e+07
+ string: string
+ normalized_string: normalized string
+ token: one two three
+ name: name
+ name_token: name-token
+ name_tokens: name tokens
+ ncname: ncname
+ language: en-us
+ qname: http://www.w3.org/2001/XMLSchema-instance#schemaLocation
+ id: elements1
+ id: elements2
+ id_ref: elements1
+ id_refs: elements1 elements2
+ any_uri: http://www.codesynthesis.com
+ base64_binary: YmFzZTY0IGJpbmFyeQ==
+
+ hex_binary: 6865782052696E617279
+ date: 2001-10-26+02:00
+ date_time: 2001-10-26T21:32:52.000000+02:00
+ duration: P1Y2M3DT5H20M30.000000S
+ day: 01+02:00
+ month: 11+02:00
+ month_day: 11-02+02:00
+ year: 2001+02:00
+ year_month: 2001-11+02:00
+ time: 21:32:52.000000+02:00
+
+ attributes:
+ byte: A
+ unsigned_byte: B
+ short: -222
+ unsigned_short: 57005
+ int: -57005
+ unsigned_int: 3735928559
+ long: -3735928559
+ unsigned_long: 16045690984833335023
+ integer: -3735928559
+ non_positive_integer: -3735928559
+ non_negative_integer: 3735928559
+ positive_integer: 3735928559
+ negative_integer: -3735928559
+ boolean: 0
+ float: 1234.12
+ double: 1.23457e+07
+ decimal: 1.23457e+07
+ string: string
+ normalized_string: normalized string
+ token: one two three
+ name: name
+ name_token: name-token
+ name_tokens: name tokens
+ ncname: ncname
+ language: en-us
+ qname: http://www.w3.org/2001/XMLSchema-instance#schemaLocation
+ id: attributes
+ id_ref: attributes
+ id_refs: attributes
+ any_uri: http://www.codesynthesis.com
+ base64_binary: YmFzZTY0IGJpbmFyeQ==
+
+ hex_binary: 6865782052696E617279
+ date: 2001-10-26+02:00
+ date_time: 2001-10-26T21:32:52.000000+02:00
+ duration: P1Y2M3DT5H20M30.000000S
+ day: 01+02:00
+ month: 11+02:00
+ month_day: 11-02+02:00
+ year: 2001+02:00
+ year_month: 2001-11+02:00
+ time: 21:32:52.000000+02:00
+
+ inherited:
+ byte: A
+ unsigned_byte: B
+ short: -222
+ unsigned_short: 57005
+ int: -57005
+ unsigned_int: 3735928559
+ long: -3735928559
+ unsigned_long: 16045690984833335023
+ integer: -3735928559
+ non_positive_integer: -3735928559
+ non_negative_integer: 3735928559
+ positive_integer: 3735928559
+ negative_integer: -3735928559
+ boolean: 1
+ float: 1234.12
+ double: 1.23457e+07
+ decimal: 1.23457e+07
+ string: string
+ normalized_string: normalized string
+ token: one two three
+ name: name
+ name_token: name-token
+ name_tokens: name tokens
+ ncname: ncname
+ language: en-us
+ qname: http://www.w3.org/2001/XMLSchema-instance#schemaLocation
+ id: elements1
+ id: elements2
+ id_ref: elements1
+ id_refs: elements1 elements2
+ any_uri: http://www.codesynthesis.com
+ base64_binary: YmFzZTY0IGJpbmFyeQ==
+
+ hex_binary: 6865782052696E617279
+ date: 2001-10-26+02:00
+ date_time: 2001-10-26T21:32:52.000000+02:00
+ duration: P1Y2M3DT5H20M30.000000S
+ day: 01+02:00
+ month: 11+02:00
+ month_day: 11-02+02:00
+ year: 2001+02:00
+ year_month: 2001-11+02:00
+ time: 21:32:52.000000+02:00
+ EOE
+}
diff --git a/xsd-tests/cxx/tree/built-in/types.xsd b/xsd-tests/cxx/tree/built-in/types.xsd
new file mode 100644
index 0000000..22582cb
--- /dev/null
+++ b/xsd-tests/cxx/tree/built-in/types.xsd
@@ -0,0 +1,460 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- elements -->
+
+ <xsd:complexType name="Elements">
+ <xsd:sequence>
+
+ <!-- integers -->
+ <xsd:element name="byte" type="xsd:byte"/>
+ <xsd:element name="unsigned_byte" type="xsd:unsignedByte"/>
+ <xsd:element name="short" type="xsd:short"/>
+ <xsd:element name="unsigned_short" type="xsd:unsignedShort"/>
+ <xsd:element name="int" type="xsd:int"/>
+ <xsd:element name="unsigned_int" type="xsd:unsignedInt"/>
+ <xsd:element name="long" type="xsd:long"/>
+ <xsd:element name="unsigned_long" type="xsd:unsignedLong"/>
+ <xsd:element name="integer" type="xsd:integer"/>
+ <xsd:element name="non_positive_integer" type="xsd:nonPositiveInteger"/>
+ <xsd:element name="non_negative_integer" type="xsd:nonNegativeInteger"/>
+ <xsd:element name="positive_integer" type="xsd:positiveInteger"/>
+ <xsd:element name="negative_integer" type="xsd:negativeInteger"/>
+
+
+ <!-- boolean -->
+ <xsd:element name="boolean" type="xsd:boolean"/>
+
+
+ <!-- floats -->
+ <xsd:element name="float" type="xsd:float"/>
+ <xsd:element name="double" type="xsd:double"/>
+ <xsd:element name="decimal" type="xsd:decimal"/>
+
+
+ <!-- strings -->
+ <xsd:element name="string" type="xsd:string"/>
+ <xsd:element name="normalized_string" type="xsd:normalizedString"/>
+ <xsd:element name="token" type="xsd:token"/>
+ <xsd:element name="name" type="xsd:Name"/>
+ <xsd:element name="name_token" type="xsd:NMTOKEN"/>
+ <xsd:element name="name_tokens" type="xsd:NMTOKENS"/>
+ <xsd:element name="ncname" type="xsd:NCName"/>
+ <xsd:element name="language" type="xsd:language"/>
+
+ <!-- qualified name -->
+ <xsd:element name="qname" type="xsd:QName"/>
+
+
+ <!-- ID/IDREF -->
+ <xsd:element name="id" maxOccurs="2" type="xsd:ID"/>
+ <xsd:element name="id_ref" type="xsd:IDREF"/>
+ <xsd:element name="id_refs" type="xsd:IDREFS"/>
+
+
+ <!-- URI -->
+ <xsd:element name="any_uri" type="xsd:anyURI"/>
+
+
+ <!-- binary -->
+ <xsd:element name="base64_binary" type="xsd:base64Binary"/>
+ <xsd:element name="hex_binary" type="xsd:hexBinary"/>
+
+
+ <!-- date/time -->
+ <xsd:element name="date" type="xsd:date"/>
+ <xsd:element name="date_time" type="xsd:dateTime"/>
+ <xsd:element name="duration" type="xsd:duration"/>
+ <xsd:element name="day" type="xsd:gDay"/>
+ <xsd:element name="month" type="xsd:gMonth"/>
+ <xsd:element name="month_day" type="xsd:gMonthDay"/>
+ <xsd:element name="year" type="xsd:gYear"/>
+ <xsd:element name="year_month" type="xsd:gYearMonth"/>
+ <xsd:element name="time" type="xsd:time"/>
+
+
+ <!-- entity -->
+ <!--
+ <xsd:element name="entity" type="xsd:ENTITY"/>
+ <xsd:element name="entities" type="xsd:ENTITIES"/>
+ -->
+
+
+ <!-- notation -->
+ <!-- xsd:element name="notation" type="xsd:NOTATION"/ -->
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="elements" type="Elements"/>
+
+
+
+ <!-- attributes -->
+
+ <xsd:complexType name="Attributes">
+ <!-- integers -->
+ <xsd:attribute name="byte" type="xsd:byte"/>
+ <xsd:attribute name="unsigned_byte" type="xsd:unsignedByte"/>
+ <xsd:attribute name="short" type="xsd:short"/>
+ <xsd:attribute name="unsigned_short" type="xsd:unsignedShort"/>
+ <xsd:attribute name="int" type="xsd:int"/>
+ <xsd:attribute name="unsigned_int" type="xsd:unsignedInt"/>
+ <xsd:attribute name="long" type="xsd:long"/>
+ <xsd:attribute name="unsigned_long" type="xsd:unsignedLong"/>
+ <xsd:attribute name="integer" type="xsd:integer"/>
+ <xsd:attribute name="non_positive_integer" type="xsd:nonPositiveInteger"/>
+ <xsd:attribute name="non_negative_integer" type="xsd:nonNegativeInteger"/>
+ <xsd:attribute name="positive_integer" type="xsd:positiveInteger"/>
+ <xsd:attribute name="negative_integer" type="xsd:negativeInteger"/>
+
+
+ <!-- boolean -->
+ <xsd:attribute name="boolean" type="xsd:boolean"/>
+
+
+ <!-- floats -->
+ <xsd:attribute name="float" type="xsd:float"/>
+ <xsd:attribute name="double" type="xsd:double"/>
+ <xsd:attribute name="decimal" type="xsd:decimal"/>
+
+
+ <!-- strings -->
+ <xsd:attribute name="string" type="xsd:string"/>
+ <xsd:attribute name="normalized_string" type="xsd:normalizedString"/>
+ <xsd:attribute name="token" type="xsd:token"/>
+ <xsd:attribute name="name" type="xsd:Name"/>
+ <xsd:attribute name="name_token" type="xsd:NMTOKEN"/>
+ <xsd:attribute name="name_tokens" type="xsd:NMTOKENS"/>
+ <xsd:attribute name="ncname" type="xsd:NCName"/>
+ <xsd:attribute name="language" type="xsd:language"/>
+
+ <!-- qualified name -->
+ <xsd:attribute name="qname" type="xsd:QName"/>
+
+
+ <!-- ID/IDREF -->
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:attribute name="id_ref" type="xsd:IDREF"/>
+ <xsd:attribute name="id_refs" type="xsd:IDREFS"/>
+
+
+ <!-- URI -->
+ <xsd:attribute name="any_uri" type="xsd:anyURI"/>
+
+
+ <!-- binary -->
+ <xsd:attribute name="base64_binary" type="xsd:base64Binary"/>
+ <xsd:attribute name="hex_binary" type="xsd:hexBinary"/>
+
+
+ <!-- date/time -->
+ <xsd:attribute name="date" type="xsd:date"/>
+ <xsd:attribute name="date_time" type="xsd:dateTime"/>
+ <xsd:attribute name="duration" type="xsd:duration"/>
+ <xsd:attribute name="day" type="xsd:gDay"/>
+ <xsd:attribute name="month" type="xsd:gMonth"/>
+ <xsd:attribute name="month_day" type="xsd:gMonthDay"/>
+ <xsd:attribute name="year" type="xsd:gYear"/>
+ <xsd:attribute name="year_month" type="xsd:gYearMonth"/>
+ <xsd:attribute name="time" type="xsd:time"/>
+
+
+ <!-- entity -->
+ <!--
+ <xsd:attribute name="entity" type="xsd:ENTITY"/>
+ <xsd:attribute name="entities" type="xsd:ENTITIES"/>
+ -->
+
+
+ <!-- notation -->
+ <!-- xsd:element name="notation" type="xsd:NOTATION"/ -->
+ </xsd:complexType>
+
+ <xsd:element name="attributes" type="Attributes"/>
+
+
+ <!-- inheritance -->
+
+ <!-- integers -->
+ <xsd:simpleType name="Byte">
+ <xsd:restriction base="xsd:byte"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="UnsignedByte">
+ <xsd:restriction base="xsd:unsignedByte"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Short">
+ <xsd:restriction base="xsd:short"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="UnsignedShort">
+ <xsd:restriction base="xsd:unsignedShort"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Int">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="UnsignedInt">
+ <xsd:restriction base="xsd:unsignedInt"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Long">
+ <xsd:restriction base="xsd:long"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="UnsignedLong">
+ <xsd:restriction base="xsd:unsignedLong"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Integer">
+ <xsd:restriction base="xsd:integer"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NonPositiveInteger">
+ <xsd:restriction base="xsd:nonPositiveInteger"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NonNegativeInteger">
+ <xsd:restriction base="xsd:nonNegativeInteger"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="PositiveInteger">
+ <xsd:restriction base="xsd:positiveInteger"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NegativeInteger">
+ <xsd:restriction base="xsd:negativeInteger"/>
+ </xsd:simpleType>
+
+
+ <!-- boolean -->
+ <xsd:simpleType name="Boolean">
+ <xsd:restriction base="xsd:boolean"/>
+ </xsd:simpleType>
+
+
+ <!-- floats -->
+ <xsd:simpleType name="Float">
+ <xsd:restriction base="xsd:float"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Double">
+ <xsd:restriction base="xsd:double"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Decimal">
+ <xsd:restriction base="xsd:decimal"/>
+ </xsd:simpleType>
+
+
+ <!-- strings -->
+ <xsd:simpleType name="String">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NormalizedString">
+ <xsd:restriction base="xsd:normalizedString"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Token">
+ <xsd:restriction base="xsd:token"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Name">
+ <xsd:restriction base="xsd:Name"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NameToken">
+ <xsd:restriction base="xsd:NMTOKEN"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NameTokens">
+ <xsd:restriction base="xsd:NMTOKENS"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="NCName">
+ <xsd:restriction base="xsd:NCName"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Language">
+ <xsd:restriction base="xsd:language"/>
+ </xsd:simpleType>
+
+
+ <!-- qualified name -->
+ <xsd:simpleType name="QName">
+ <xsd:restriction base="xsd:QName"/>
+ </xsd:simpleType>
+
+
+ <!-- ID/IDREF -->
+ <xsd:simpleType name="Id">
+ <xsd:restriction base="xsd:ID"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="IdRef">
+ <xsd:restriction base="xsd:IDREF"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="IdRefs">
+ <xsd:restriction base="xsd:IDREFS"/>
+ </xsd:simpleType>
+
+
+ <!-- URI -->
+ <xsd:simpleType name="URI">
+ <xsd:restriction base="xsd:anyURI"/>
+ </xsd:simpleType>
+
+
+ <!-- binary -->
+ <xsd:simpleType name="Base64Binary">
+ <xsd:restriction base="xsd:base64Binary"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="HexBinary">
+ <xsd:restriction base="xsd:hexBinary"/>
+ </xsd:simpleType>
+
+
+ <!-- date/time -->
+ <xsd:simpleType name="Date">
+ <xsd:restriction base="xsd:date"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="DateTime">
+ <xsd:restriction base="xsd:dateTime"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Duration">
+ <xsd:restriction base="xsd:duration"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Day">
+ <xsd:restriction base="xsd:gDay"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Month">
+ <xsd:restriction base="xsd:gMonth"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="MonthDay">
+ <xsd:restriction base="xsd:gMonthDay"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Year">
+ <xsd:restriction base="xsd:gYear"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="YearMonth">
+ <xsd:restriction base="xsd:gYearMonth"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="Time">
+ <xsd:restriction base="xsd:time"/>
+ </xsd:simpleType>
+
+
+ <!-- entity -->
+ <!--
+ <xsd:element name="entity" type="xsd:ENTITY"/>
+ <xsd:element name="entities" type="xsd:ENTITIES"/>
+ -->
+
+
+ <!-- notation -->
+ <!-- xsd:element name="notation" type="xsd:NOTATION"/ -->
+
+ <!-- elements -->
+
+ <xsd:complexType name="Inherited">
+ <xsd:sequence>
+
+ <!-- integers -->
+ <xsd:element name="byte" type="Byte"/>
+ <xsd:element name="unsigned_byte" type="UnsignedByte"/>
+ <xsd:element name="short" type="Short"/>
+ <xsd:element name="unsigned_short" type="UnsignedShort"/>
+ <xsd:element name="int" type="Int"/>
+ <xsd:element name="unsigned_int" type="UnsignedInt"/>
+ <xsd:element name="long" type="Long"/>
+ <xsd:element name="unsigned_long" type="UnsignedLong"/>
+ <xsd:element name="integer" type="Integer"/>
+ <xsd:element name="non_positive_integer" type="NonPositiveInteger"/>
+ <xsd:element name="non_negative_integer" type="NonNegativeInteger"/>
+ <xsd:element name="positive_integer" type="PositiveInteger"/>
+ <xsd:element name="negative_integer" type="NegativeInteger"/>
+
+
+ <!-- boolean -->
+ <xsd:element name="boolean" type="Boolean"/>
+
+
+ <!-- floats -->
+ <xsd:element name="float" type="Float"/>
+ <xsd:element name="double" type="Double"/>
+ <xsd:element name="decimal" type="Decimal"/>
+
+
+ <!-- strings -->
+ <xsd:element name="string" type="String"/>
+ <xsd:element name="normalized_string" type="NormalizedString"/>
+ <xsd:element name="token" type="Token"/>
+ <xsd:element name="name" type="Name"/>
+ <xsd:element name="name_token" type="NameToken"/>
+ <xsd:element name="name_tokens" type="NameTokens"/>
+ <xsd:element name="ncname" type="NCName"/>
+ <xsd:element name="language" type="Language"/>
+
+ <!-- qualified name -->
+ <xsd:element name="qname" type="QName"/>
+
+
+ <!-- ID/IDREF -->
+ <xsd:element name="id" maxOccurs="2" type="Id"/>
+ <xsd:element name="id_ref" type="IdRef"/>
+ <xsd:element name="id_refs" type="IdRefs"/>
+
+
+ <!-- URI -->
+ <xsd:element name="any_uri" type="URI"/>
+
+
+ <!-- binary -->
+ <xsd:element name="base64_binary" type="Base64Binary"/>
+ <xsd:element name="hex_binary" type="HexBinary"/>
+
+
+ <!-- date/time -->
+ <xsd:element name="date" type="Date"/>
+ <xsd:element name="date_time" type="DateTime"/>
+ <xsd:element name="duration" type="Duration"/>
+ <xsd:element name="day" type="Day"/>
+ <xsd:element name="month" type="Month"/>
+ <xsd:element name="month_day" type="MonthDay"/>
+ <xsd:element name="year" type="Year"/>
+ <xsd:element name="year_month" type="YearMonth"/>
+ <xsd:element name="time" type="Time"/>
+
+
+ <!-- entity -->
+ <!--
+ <xsd:element name="entity" type="xsd:ENTITY"/>
+ <xsd:element name="entities" type="xsd:ENTITIES"/>
+ -->
+
+
+ <!-- notation -->
+ <!-- xsd:element name="notation" type="xsd:NOTATION"/ -->
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="inherited" type="Inherited"/>
+
+</xsd:schema>
diff --git a/xsd-tests/cxx/tree/chameleon/.gitignore b/xsd-tests/cxx/tree/chameleon/.gitignore
new file mode 100644
index 0000000..4ec7484
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/.gitignore
@@ -0,0 +1 @@
+includer.?xx
diff --git a/xsd-tests/cxx/tree/chameleon/buildfile b/xsd-tests/cxx/tree/chameleon/buildfile
new file mode 100644
index 0000000..cec3b01
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/tree/chameleon/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -includer} {hxx ixx cxx}{includer} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{includer}>: xsd{includer includee} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-ostream \
+ --root-element root \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/chameleon/driver.cxx b/xsd-tests/cxx/tree/chameleon/driver.cxx
new file mode 100644
index 0000000..c22ca55
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/driver.cxx
@@ -0,0 +1,35 @@
+// file : cxx/tree/chameleon/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test chameleon inclusion.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "includer.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<root_t> r (root (argv[1]));
+
+ cout << *r << endl;
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/chameleon/includee.xsd b/xsd-tests/cxx/tree/chameleon/includee.xsd
new file mode 100644
index 0000000..531a7d0
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/includee.xsd
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:complexType name="root_t">
+ <xsd:sequence>
+ <xsd:element name="a" type="type"/>
+ <xsd:element ref="b"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="root" type="root_t"/>
+
+</xsd:schema>
diff --git a/xsd-tests/cxx/tree/chameleon/includer.xsd b/xsd-tests/cxx/tree/chameleon/includer.xsd
new file mode 100644
index 0000000..a1c850a
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/includer.xsd
@@ -0,0 +1,12 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="test" targetNamespace="test">
+
+ <xsd:include schemaLocation="includee.xsd"/>
+
+ <xsd:simpleType name="type">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="b" type="xsd:string"/>
+
+</xsd:schema>
diff --git a/xsd-tests/cxx/tree/chameleon/output b/xsd-tests/cxx/tree/chameleon/output
new file mode 100644
index 0000000..c40f715
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/output
@@ -0,0 +1,3 @@
+
+a: a
+b: b
diff --git a/xsd-tests/cxx/tree/chameleon/test.xml b/xsd-tests/cxx/tree/chameleon/test.xml
new file mode 100644
index 0000000..12ff279
--- /dev/null
+++ b/xsd-tests/cxx/tree/chameleon/test.xml
@@ -0,0 +1,8 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test includer.xsd">
+
+ <a>a</a>
+ <t:b>b</t:b>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/comparison/buildfile b/xsd-tests/cxx/tree/comparison/buildfile
new file mode 100644
index 0000000..507a703
--- /dev/null
+++ b/xsd-tests/cxx/tree/comparison/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/tree/comparison/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/comparison/driver.cxx b/xsd-tests/cxx/tree/comparison/driver.cxx
new file mode 100644
index 0000000..aa7b66d
--- /dev/null
+++ b/xsd-tests/cxx/tree/comparison/driver.cxx
@@ -0,0 +1,38 @@
+// file : cxx/tree/comparison/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test generated comparison operators.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ type::complex_sequence s (r->complex ());
+
+ assert (s[0] == s[0]);
+ assert (s[0] != s[1]);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/comparison/test.xml b/xsd-tests/cxx/tree/comparison/test.xml
new file mode 100644
index 0000000..b5d8158
--- /dev/null
+++ b/xsd-tests/cxx/tree/comparison/test.xml
@@ -0,0 +1,19 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <complex x="123" y="abc">
+ <a>123</a>
+ <b>abc</b>
+ <c x="123">abc</c>
+ <c x="456">def</c>
+ </complex>
+
+ <complex x="123" y="abc">
+ <a>123</a>
+ <b>abc</b>
+ <c x="123">abc</c>
+ <c x="456">xyz</c>
+ </complex>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/comparison/test.xsd b/xsd-tests/cxx/tree/comparison/test.xsd
new file mode 100644
index 0000000..c234add
--- /dev/null
+++ b/xsd-tests/cxx/tree/comparison/test.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="member">
+ <simpleContent>
+ <extension base="string">
+ <attribute name="x" type="int" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="complex">
+ <sequence>
+ <element name="a" type="int"/>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="t:member" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="x" type="int"/>
+ <attribute name="y" type="string" use="required"/>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="complex" type="t:complex" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/compilation/buildfile b/xsd-tests/cxx/tree/compilation/buildfile
new file mode 100644
index 0000000..bec2b4b
--- /dev/null
+++ b/xsd-tests/cxx/tree/compilation/buildfile
@@ -0,0 +1,20 @@
+# file : cxx/tree/compilation/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/compilation/driver.cxx b/xsd-tests/cxx/tree/compilation/driver.cxx
new file mode 100644
index 0000000..5c5ab39
--- /dev/null
+++ b/xsd-tests/cxx/tree/compilation/driver.cxx
@@ -0,0 +1,116 @@
+// file : cxx/tree/compilation/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Make sure the runtime library compiles by explicitly instantiating
+// all the types.
+//
+
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+template class xsd::cxx::tree::simple_type<char, xml_schema::type>;
+
+// String types.
+//
+template class xsd::cxx::tree::string< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::normalized_string< char, xml_schema::string >;
+template class xsd::cxx::tree::token< char, xml_schema::normalized_string >;
+template class xsd::cxx::tree::name< char, xml_schema::token >;
+template class xsd::cxx::tree::nmtoken< char, xml_schema::token >;
+template class xsd::cxx::tree::nmtokens< char, xml_schema::simple_type, xml_schema::nmtoken >;
+template class xsd::cxx::tree::ncname< char, xml_schema::name >;
+template class xsd::cxx::tree::language< char, xml_schema::token >;
+
+// ID/IDREF.
+//
+template class xsd::cxx::tree::id< char, xml_schema::ncname >;
+template class xsd::cxx::tree::idref< char, xml_schema::ncname, xml_schema::type >;
+template class xsd::cxx::tree::idrefs< char, xml_schema::simple_type, xml_schema::idref >;
+
+// URI.
+//
+template class xsd::cxx::tree::uri< char, xml_schema::simple_type >;
+
+// Qualified name.
+//
+template class xsd::cxx::tree::qname< char, xml_schema::simple_type, xml_schema::uri, xml_schema::ncname >;
+
+// Binary.
+//
+template class xsd::cxx::tree::buffer< char >;
+template class xsd::cxx::tree::base64_binary< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::hex_binary< char, xml_schema::simple_type >;
+
+// Date/time.
+//
+template class xsd::cxx::tree::date< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::date_time< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::duration< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::gday< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::gmonth< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::gmonth_day< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::gyear< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::gyear_month< char, xml_schema::simple_type >;
+template class xsd::cxx::tree::time< char, xml_schema::simple_type >;
+
+// Entity.
+//
+template class xsd::cxx::tree::entity< char, xml_schema::ncname >;
+template class xsd::cxx::tree::entities< char, xml_schema::simple_type, xml_schema::entity >;
+
+// Namespace information and list stream. Used in
+// serialization functions.
+//
+template class xsd::cxx::xml::dom::namespace_info < char >;
+template class xsd::cxx::xml::dom::namespace_infomap < char >;
+template class xsd::cxx::tree::list_stream < char >;
+
+// Flags and properties.
+//
+template class xsd::cxx::tree::properties< char >;
+
+// Exceptions.
+//
+template class xsd::cxx::tree::exception< char >;
+template class xsd::cxx::tree::parsing< char >;
+template class xsd::cxx::tree::expected_element< char >;
+template class xsd::cxx::tree::unexpected_element< char >;
+template class xsd::cxx::tree::expected_attribute< char >;
+template class xsd::cxx::tree::unexpected_enumerator< char >;
+template class xsd::cxx::tree::expected_text_content< char >;
+template class xsd::cxx::tree::no_type_info< char >;
+template class xsd::cxx::tree::not_derived< char >;
+template class xsd::cxx::tree::duplicate_id< char >;
+template class xsd::cxx::tree::serialization< char >;
+template class xsd::cxx::tree::no_prefix_mapping< char >;
+template class xsd::cxx::tree::bounds< char >;
+
+// Parsing/serialization diagnostics.
+//
+template class xsd::cxx::tree::error< char >;
+template class xsd::cxx::tree::diagnostics< char >;
+
+// Error handler interface.
+//
+template class xsd::cxx::xml::error_handler< char >;
+
+
+//
+//
+template class xsd::cxx::tree::fundamental_base<int, char, xml_schema::type>;
+template class xsd::cxx::tree::one<int>;
+template class xsd::cxx::tree::one<xml_schema::string>;
+template class xsd::cxx::tree::optional<int>;
+template class xsd::cxx::tree::optional<xml_schema::string>;
+template class xsd::cxx::tree::sequence<int>;
+template class xsd::cxx::tree::sequence<xml_schema::string>;
+
+
+int
+main ()
+{
+}
diff --git a/xsd-tests/cxx/tree/compilation/test.xsd b/xsd-tests/cxx/tree/compilation/test.xsd
new file mode 100644
index 0000000..07bebc7
--- /dev/null
+++ b/xsd-tests/cxx/tree/compilation/test.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/complex/ctor/buildfile b/xsd-tests/cxx/tree/complex/ctor/buildfile
new file mode 100644
index 0000000..53e32b7
--- /dev/null
+++ b/xsd-tests/cxx/tree/complex/ctor/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/complex/ctor/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --generate-doxygen \
+ --generate-polymorphic \
+ --polymorphic-type-all \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/complex/ctor/driver.cxx b/xsd-tests/cxx/tree/complex/ctor/driver.cxx
new file mode 100644
index 0000000..7beaa93
--- /dev/null
+++ b/xsd-tests/cxx/tree/complex/ctor/driver.cxx
@@ -0,0 +1,122 @@
+// file : cxx/tree/complex/ctor/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test generation of varous complex type constructors.
+//
+
+#include <cassert>
+#include <memory>
+
+#include "test.hxx"
+
+#ifdef XSD_CXX11
+# include <utility> // std::move
+# define XSD_MOVE(x) std::move(x)
+#else
+# define XSD_MOVE(x) x
+#endif
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ // Test case A.
+ //
+ {
+ a_base b1;
+ a_base b2 ("abc"); // empty ultimate base + required
+ a_base b3 ("abc", "foo"); // ultimate base + required
+
+ a_derived a1;
+ a_derived a2 ("foo", "bar"); // empty ultimate base + required
+ a_derived a3 (b3, "bar"); // base + required
+ a_derived a4 ("abc", "foo", "bar"); // ultimate base + required
+ }
+
+ // Test case B.
+ //
+ {
+ b_simple s ("base");
+ b_base b ("base", "foo");
+ b_derived d ("base", "foo", "bar");
+ b_type t ("base");
+ }
+
+ // Test case C.
+ //
+ {
+ c_simple s (c_enum::a);
+ c_base b (c_enum::a, "foo");
+ c_derived d (c_enum::a, "foo", "bar");
+ c_type t (c_enum::a);
+ }
+
+ // Test case D.
+ //
+ {
+ d_simple s (1);
+ d_base b (1, "foo");
+ d_derived d (1, "foo", "bar");
+ d_type t (1);
+ }
+
+ // Test case E.
+ //
+ {
+ // e_base
+ //
+ e_base b1 (1, "foo", e_complex_type ("bar"));
+
+ XSD_AUTO_PTR<e_complex_type> c2 (new e_complex_type ("bar"));
+ e_base b2 (1, "foo", XSD_MOVE (c2));
+
+ XSD_AUTO_PTR<e_simple_type> s3 (new e_simple_type ("foo"));
+ XSD_AUTO_PTR<e_complex_type> c3 (new e_complex_type ("bar"));
+ e_base b3 (1, XSD_MOVE (s3), XSD_MOVE (c3));
+
+ assert (b1 == b2);
+ assert (b1 == b3);
+
+ // e_derived
+ //
+ e_derived d1 (1, "foo", e_complex_type ("bar"),
+ true, "baz", e_complex_type ("biz"));
+
+ XSD_AUTO_PTR<e_complex_type> c2a (new e_complex_type ("bar"));
+ XSD_AUTO_PTR<e_complex_type> c2b (new e_complex_type ("biz"));
+ e_derived d2 (1, "foo", XSD_MOVE (c2a), true, "baz", XSD_MOVE (c2b));
+
+ XSD_AUTO_PTR<e_simple_type> s3a (new e_simple_type ("foo"));
+ XSD_AUTO_PTR<xml_schema::string> s3b (new xml_schema::string ("baz"));
+ XSD_AUTO_PTR<e_complex_type> c3a (new e_complex_type ("bar"));
+ XSD_AUTO_PTR<e_complex_type> c3b (new e_complex_type ("biz"));
+ e_derived d3 (1,
+ XSD_MOVE (s3a),
+ XSD_MOVE (c3a),
+ true,
+ XSD_MOVE (s3b),
+ XSD_MOVE (c3b));
+
+ assert (d1 == d2);
+ assert (d1 == d3);
+
+ }
+
+ // Test case F.
+ //
+ {
+ f_type f1 (xml_schema::type (), 1, "foo", f_complex_type ("bar"));
+
+ XSD_AUTO_PTR<f_complex_type> c2 (new f_complex_type ("bar"));
+ f_type f2 (1, "foo", XSD_MOVE (c2));
+
+ XSD_AUTO_PTR<f_simple_type> s3 (new f_simple_type ("foo"));
+ XSD_AUTO_PTR<f_complex_type> c3 (new f_complex_type ("bar"));
+ f_type f3 (1, XSD_MOVE (s3), XSD_MOVE (c3));
+
+ assert (f1 == f2);
+ assert (f1 == f3);
+ }
+}
diff --git a/xsd-tests/cxx/tree/complex/ctor/test.xsd b/xsd-tests/cxx/tree/complex/ctor/test.xsd
new file mode 100644
index 0000000..b8dd95e
--- /dev/null
+++ b/xsd-tests/cxx/tree/complex/ctor/test.xsd
@@ -0,0 +1,182 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Test case A: several levels of inheritance with ultimate base. -->
+
+ <complexType name="a_base">
+ <simpleContent>
+ <extension base="string">
+ <attribute name="foo" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="a_derived">
+ <simpleContent>
+ <extension base="t:a_base">
+ <attribute name="bar" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <!-- Test case B: string-based c-tors. -->
+
+ <simpleType name="b_simple">
+ <restriction base="string">
+ </restriction>
+ </simpleType>
+
+ <complexType name="b_base">
+ <simpleContent>
+ <extension base="t:b_simple">
+ <attribute name="foo" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="b_derived">
+ <simpleContent>
+ <extension base="t:b_base">
+ <attribute name="bar" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="b_type">
+ <sequence>
+ <element name="a" type="t:b_simple"/>
+ </sequence>
+ </complexType>
+
+ <!-- Test case C: enum-based c-tors. -->
+
+ <simpleType name="c_enum_base">
+ <restriction base="string">
+ <enumeration value="a"/>
+ <enumeration value="b"/>
+ <enumeration value="c"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="c_enum">
+ <restriction base="t:c_enum_base">
+ <enumeration value="a"/>
+ <enumeration value="c"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="c_simple">
+ <restriction base="t:c_enum">
+ </restriction>
+ </simpleType>
+
+ <complexType name="c_base">
+ <simpleContent>
+ <extension base="t:c_simple">
+ <attribute name="foo" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="c_derived">
+ <simpleContent>
+ <extension base="t:c_base">
+ <attribute name="bar" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="c_type">
+ <sequence>
+ <element name="a" type="t:c_simple"/>
+ </sequence>
+ </complexType>
+
+ <!-- Test case D: fundamental type c-tors. -->
+
+ <simpleType name="d_simple">
+ <restriction base="int">
+ </restriction>
+ </simpleType>
+
+ <complexType name="d_base">
+ <simpleContent>
+ <extension base="t:d_simple">
+ <attribute name="foo" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="d_derived">
+ <simpleContent>
+ <extension base="t:d_base">
+ <attribute name="bar" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="d_type">
+ <sequence>
+ <element name="a" type="t:d_simple"/>
+ </sequence>
+ </complexType>
+
+ <!-- Test case E: auto_ptr ctors. -->
+
+ <simpleType name="e_simple_type">
+ <restriction base="string">
+ </restriction>
+ </simpleType>
+
+ <complexType name="e_complex_type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="e_base">
+ <sequence>
+ <element name="fund" type="int"/>
+ <element name="simple" type="t:e_simple_type"/>
+ <element name="complex" type="t:e_complex_type"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="e_derived">
+ <complexContent>
+ <extension base="t:e_base">
+ <sequence>
+ <element name="fund1" type="boolean"/>
+ <element name="simple1" type="string"/>
+ <element name="complex1" type="t:e_complex_type"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- Test case F: auto_ptr args in c-tor (all-non-optional-members) -->
+
+ <simpleType name="f_simple_type">
+ <restriction base="string">
+ </restriction>
+ </simpleType>
+
+ <complexType name="f_complex_type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="f_type">
+ <complexContent>
+ <restriction base="anyType">
+ <sequence>
+ <element name="fund" type="int"/>
+ <element name="simple" type="t:f_simple_type"/>
+ <element name="complex" type="t:f_complex_type"/>
+ </sequence>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/containment/buildfile b/xsd-tests/cxx/tree/containment/buildfile
new file mode 100644
index 0000000..1d0272b
--- /dev/null
+++ b/xsd-tests/cxx/tree/containment/buildfile
@@ -0,0 +1,20 @@
+# file : cxx/tree/containment/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-default-ctor \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/containment/driver.cxx b/xsd-tests/cxx/tree/containment/driver.cxx
new file mode 100644
index 0000000..65c17fc
--- /dev/null
+++ b/xsd-tests/cxx/tree/containment/driver.cxx
@@ -0,0 +1,118 @@
+// file : cxx/tree/containment/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test tree node containment.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+
+#include "test.hxx"
+
+#ifdef XSD_CXX11
+# include <utility> // std::move
+# define XSD_MOVE(x) std::move(x)
+#else
+# define XSD_MOVE(x) x
+#endif
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ // Change of a container in a sub-tree without ID.
+ //
+ {
+ XSD_AUTO_PTR<inner> i (new inner ());
+ i->ref ("foo");
+
+ outer o;
+ o.i (XSD_MOVE (i));
+ o.ref ("foo");
+
+ assert (o.i ()->ref ()->get () == 0);
+ assert (o.ref ()->get () == 0);
+ }
+
+ // Change of container in a sub-tree with ID inside.
+ //
+ {
+ XSD_AUTO_PTR<inner> i (new inner ());
+ inner* p (i.get ());
+ i->id ("foo");
+ i->ref ("foo");
+ assert (i->ref ()->get () == p);
+
+ outer o;
+ o.i (XSD_MOVE (i));
+ o.ref ("foo");
+
+ assert (o.i ()->ref ()->get () == p);
+ assert (o.ref ()->get () == p);
+ }
+
+ // Change of a container in ID.
+ //
+ {
+ XSD_AUTO_PTR<xml_schema::id> id (new xml_schema::id ("foo"));
+
+ inner i;
+ i.id (XSD_MOVE (id));
+ i.ref ("foo");
+ assert (i.ref ()->get () == &i);
+ }
+
+ // Change of a container in a type derived from ID with ID inside.
+ //
+ {
+ XSD_AUTO_PTR<id_ex> id (new id_ex ("foo"));
+ id_ex* p (id.get ());
+ id->id ("bar");
+
+ inner i;
+ i.id_ex (XSD_MOVE (id));
+
+ i.ref ("foo");
+ assert (i.ref ()->get () == &i);
+
+ i.ref ("bar");
+ assert (i.ref ()->get () == p);
+ }
+
+ // IDREF lists
+ //
+ {
+ id i1 ("a"), i2 ("b");
+
+ XSD_AUTO_PTR<ids> ic (new ids);
+ ic->id ().push_back (i1);
+ ic->id ().push_back (i2);
+
+ XSD_AUTO_PTR<xml_schema::idrefs> r1 (new xml_schema::idrefs);
+ r1->push_back (xml_schema::idref ("a"));
+ r1->push_back (xml_schema::idref ("b"));
+
+ XSD_AUTO_PTR<idref_list> r2 (new idref_list);
+ r2->push_back (xml_schema::idref ("a"));
+ r2->push_back (xml_schema::idref ("b"));
+
+ XSD_AUTO_PTR<idrefs1> rc1 (new idrefs1);
+ XSD_AUTO_PTR<idrefs2> rc2 (new idrefs2);
+
+ rc1->idrefs (XSD_MOVE (r1));
+ rc2->idrefs (XSD_MOVE (r2));
+
+ model m;
+ m.ids (XSD_MOVE (ic));
+ m.idrefs1 (XSD_MOVE (rc1));
+ m.idrefs2 (XSD_MOVE (rc2));
+
+ assert (m.idrefs1 ().idrefs ()[0].get () != 0);
+ assert (m.idrefs1 ().idrefs ()[1].get () != 0);
+
+ assert (m.idrefs2 ().idrefs ()[0].get () != 0);
+ assert (m.idrefs2 ().idrefs ()[1].get () != 0);
+ }
+}
diff --git a/xsd-tests/cxx/tree/containment/test.xsd b/xsd-tests/cxx/tree/containment/test.xsd
new file mode 100644
index 0000000..72c9379
--- /dev/null
+++ b/xsd-tests/cxx/tree/containment/test.xsd
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="id-ex">
+ <simpleContent>
+ <extension base="ID">
+ <attribute name="id" type="ID"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="inner">
+ <sequence>
+ <element name="id" type="ID" minOccurs="0"/>
+ <element name="id-ex" type="t:id-ex" minOccurs="0"/>
+ <element name="ref" type="IDREF" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="outer">
+ <sequence>
+ <element name="i" type="t:inner" minOccurs="0"/>
+ <element name="ref" type="IDREF" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <!-- IDREF lists -->
+
+ <complexType name="id">
+ <attribute name="id" type="ID" use="required"/>
+ </complexType>
+
+ <complexType name="ids">
+ <sequence>
+ <element name="id" type="t:id" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="idrefs1">
+ <attribute name="idrefs" type="IDREFS" use="required"/>
+ </complexType>
+
+ <simpleType name="idref-list">
+ <list itemType="IDREF"/>
+ </simpleType>
+
+ <complexType name="idrefs2">
+ <attribute name="idrefs" type="t:idref-list" use="required"/>
+ </complexType>
+
+ <complexType name="model">
+ <sequence>
+ <element name="ids" type="t:ids"/>
+ <element name="idrefs1" type="t:idrefs1"/>
+ <element name="idrefs2" type="t:idrefs2"/>
+ </sequence>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/default/general/buildfile b/xsd-tests/cxx/tree/default/general/buildfile
new file mode 100644
index 0000000..4e482ce
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/general/buildfile
@@ -0,0 +1,26 @@
+# file : cxx/tree/default/general/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-ostream \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/default/general/driver.cxx b/xsd-tests/cxx/tree/default/general/driver.cxx
new file mode 100644
index 0000000..7031636
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/general/driver.cxx
@@ -0,0 +1,37 @@
+// file : cxx/tree/default/general/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test default attribute/element values.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1], xml_schema::flags::dont_validate));
+
+ xml_schema::namespace_infomap map;
+ map["t"].name = "test";
+ root (cout, *r, map);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/default/general/output b/xsd-tests/cxx/tree/default/general/output
new file mode 100644
index 0000000..396a698
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/general/output
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test" base64_bin1="" base64_bin2="YmFzZTY0IGJpbmFyeQ==&#xA;" bool1="true" bool2="true" bool3="false" bool4="false" byte="-99" decimal1="1.12345" decimal2="-0.456" double1="1.12345" double2="1123.45" double3="-0.00012345" double4="NaN" double5="-INF" fix1="123" fix2="123" fix3="abc" fix4="abc" fix5="aaa bbb ccc" fix6="aaa bbb ccc" float1="1.123" float2="1123" float3="-0.000123" float4="NaN" float5="-INF" hex_bin1="" hex_bin2="6865782052696E617279" id="this" idref="this" idrefs="this" int="-99999" integer="-99999" language="en-us" long="-99999" ncname="abcd" ninteger="-99999" nmtoken="ab:cd" nmtokens1="a:b efg aaa" nmtokens2="abc" nninteger="99999" npinteger="-99999" nstring=" a b " pinteger="99999" qname1="foo" qname2="t:bar" short="-999" string1="" string2=" a b " token="a b" ubyte="99" uint="99999" ulong="99999" uri="http://example.com" ushort="999">
+ <union a="abc"/>
+ <list a="123 345 678" b="ab cd ef" c="abc" d="abc def"/>
+ <simple a="123" b="abc" c="123" d="abc" e="abc" f="abc 123"/>
+ <date a="2009-03-31" b="2009-03-31Z" c="2009-03-31Z" d="2009-03-31Z" e="2009-03-31+12:30" f="2009-03-31-12:30" g="2002009-03-31-12:30"/>
+ <time a="12:03:45" b="12:03:45.123Z" c="12:03:05.123Z" d="12:03:45.123Z" e="12:03:45.123+12:30" f="12:03:45-12:30"/>
+ <date-time a="2009-03-31T12:03:45" b="2009-03-31T12:03:45.123Z" c="2002009-03-31T12:03:05.123-12:30"/>
+ <duration a="P100Y" b="P100M" c="P100D" d="PT12H" e="PT12M" f="PT12.123S" g="-P100Y10M20DT12H12M1.123S"/>
+ <day a="---02" b="---22Z" c="---22-12:30"/>
+ <month a="--02" b="--12Z" c="--12+12:30"/>
+ <year a="2009" b="-2002009Z" c="2009-12:30"/>
+ <month-day a="--02-02" b="--12-22Z" c="--12-22+12:30"/>
+ <year-month a="2009-02" b="-2002009-12Z" c="2009-12-12:30"/>
+</t:root>
diff --git a/xsd-tests/cxx/tree/default/general/test.xml b/xsd-tests/cxx/tree/default/general/test.xml
new file mode 100644
index 0000000..11bd0a7
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/general/test.xml
@@ -0,0 +1,16 @@
+<t:root xmlns:t="test" id="this" fix2="123" fix4="abc" fix6="aaa bbb ccc">
+
+ <union/>
+ <list/>
+ <simple/>
+ <date/>
+ <time/>
+ <date-time/>
+ <duration/>
+ <day/>
+ <month/>
+ <year/>
+ <month-day/>
+ <year-month/>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/default/general/test.xsd b/xsd-tests/cxx/tree/default/general/test.xsd
new file mode 100644
index 0000000..9d9cd38
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/general/test.xsd
@@ -0,0 +1,241 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- union -->
+
+ <xs:simpleType name="union">
+ <xs:union memberTypes="xs:int xs:string"/>
+ </xs:simpleType>
+
+ <xs:complexType name="union-test">
+ <xs:attribute default="abc" name="a" type="t:union"/>
+ </xs:complexType>
+
+ <!-- list -->
+
+ <xs:simpleType name="fix-list">
+ <xs:list itemType="xs:int"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="var-list">
+ <xs:list itemType="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="list-item">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="usr-list">
+ <xs:list itemType="t:list-item"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="union-list">
+ <xs:list itemType="t:union"/>
+ </xs:simpleType>
+
+ <xs:complexType name="list-test">
+ <xs:attribute default="123 345 678" name="a" type="t:fix-list"/>
+ <xs:attribute default=" ab cd ef " name="b" type="t:var-list"/>
+ <xs:attribute default="abc" name="c" type="t:usr-list"/>
+ <xs:attribute default="abc def" name="d" type="t:union-list"/>
+ </xs:complexType>
+
+ <!-- simple type -->
+
+ <xs:simpleType name="int-base">
+ <xs:restriction base="xs:int"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="str-base">
+ <xs:restriction base="xs:string"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="int">
+ <xs:restriction base="t:int-base"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="str">
+ <xs:restriction base="t:str-base"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="union-derived">
+ <xs:restriction base="t:union"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="list-derived">
+ <xs:restriction base="t:usr-list"/>
+ </xs:simpleType>
+
+ <xs:complexType name="simple-test">
+ <xs:attribute default="123" name="a" type="t:int-base"/>
+ <xs:attribute default="abc" name="b" type="t:str-base"/>
+ <xs:attribute default="123" name="c" type="t:int"/>
+ <xs:attribute default="abc" name="d" type="t:str"/>
+ <xs:attribute default="abc" name="e" type="t:union-derived"/>
+ <xs:attribute default="abc 123" name="f" type="t:list-derived"/>
+ </xs:complexType>
+
+ <!-- date/time types -->
+
+ <xs:simpleType name="date-derived">
+ <xs:restriction base="xs:date"/>
+ </xs:simpleType>
+
+ <xs:complexType name="date-test">
+ <xs:attribute default="2009-03-31" name="a" type="xs:date"/>
+ <xs:attribute default="2009-03-31Z" name="b" type="xs:date"/>
+ <xs:attribute default="2009-03-31+00:00" name="c" type="xs:date"/>
+ <xs:attribute default="2009-03-31-00:00" name="d" type="xs:date"/>
+ <xs:attribute default="2009-03-31+12:30" name="e" type="xs:date"/>
+ <xs:attribute default="2009-03-31-12:30" name="f" type="xs:date"/>
+ <xs:attribute default="2002009-03-31-12:30" name="g" type="t:date-derived"/>
+ </xs:complexType>
+
+ <xs:complexType name="time-test">
+ <xs:attribute default="12:03:45" name="a" type="xs:time"/>
+ <xs:attribute default="12:03:45.123Z" name="b" type="xs:time"/>
+ <xs:attribute default="12:03:05.123+00:00" name="c" type="xs:time"/>
+ <xs:attribute default="12:03:45.123-00:00" name="d" type="xs:time"/>
+ <xs:attribute default="12:03:45.123+12:30" name="e" type="xs:time"/>
+ <xs:attribute default="12:03:45-12:30" name="f" type="xs:time"/>
+ </xs:complexType>
+
+ <xs:complexType name="date-time-test">
+ <xs:attribute default="2009-03-31T12:03:45" name="a" type="xs:dateTime"/>
+ <xs:attribute default="2009-03-31T12:03:45.123Z" name="b" type="xs:dateTime"/>
+ <xs:attribute default="2002009-03-31T12:03:05.123-12:30" name="c" type="xs:dateTime"/>
+ </xs:complexType>
+
+ <xs:complexType name="duration-test">
+ <xs:attribute default="P100Y" name="a" type="xs:duration"/>
+ <xs:attribute default="P100M" name="b" type="xs:duration"/>
+ <xs:attribute default="P100D" name="c" type="xs:duration"/>
+ <xs:attribute default="PT12H" name="d" type="xs:duration"/>
+ <xs:attribute default="PT12M" name="e" type="xs:duration"/>
+ <xs:attribute default="PT12.123S" name="f" type="xs:duration"/>
+ <xs:attribute default="-P100Y10M20DT12H12M1.123S" name="g" type="xs:duration"/>
+ </xs:complexType>
+
+ <xs:complexType name="day-test">
+ <xs:attribute default="---02" name="a" type="xs:gDay"/>
+ <xs:attribute default="---22Z" name="b" type="xs:gDay"/>
+ <xs:attribute default="---22-12:30" name="c" type="xs:gDay"/>
+ </xs:complexType>
+
+ <xs:complexType name="month-test">
+ <xs:attribute default="--02" name="a" type="xs:gMonth"/>
+ <xs:attribute default="--12Z" name="b" type="xs:gMonth"/>
+ <xs:attribute default="--12+12:30" name="c" type="xs:gMonth"/>
+ </xs:complexType>
+
+ <xs:complexType name="year-test">
+ <xs:attribute default="2009" name="a" type="xs:gYear"/>
+ <xs:attribute default="-2002009Z" name="b" type="xs:gYear"/>
+ <xs:attribute default="2009-12:30" name="c" type="xs:gYear"/>
+ </xs:complexType>
+
+ <xs:complexType name="month-day-test">
+ <xs:attribute default="--02-02" name="a" type="xs:gMonthDay"/>
+ <xs:attribute default="--12-22Z" name="b" type="xs:gMonthDay"/>
+ <xs:attribute default="--12-22+12:30" name="c" type="xs:gMonthDay"/>
+ </xs:complexType>
+
+ <xs:complexType name="year-month-test">
+ <xs:attribute default="2009-02" name="a" type="xs:gYearMonth"/>
+ <xs:attribute default="-2002009-12Z" name="b" type="xs:gYearMonth"/>
+ <xs:attribute default="2009-12-12:30" name="c" type="xs:gYearMonth"/>
+ </xs:complexType>
+
+
+ <xs:complexType name="type">
+ <xs:sequence>
+ <xs:element name="union" type="t:union-test"/>
+ <xs:element name="list" type="t:list-test"/>
+ <xs:element name="simple" type="t:simple-test"/>
+ <xs:element name="date" type="t:date-test"/>
+ <xs:element name="time" type="t:time-test"/>
+ <xs:element name="date-time" type="t:date-time-test"/>
+ <xs:element name="duration" type="t:duration-test"/>
+ <xs:element name="day" type="t:day-test"/>
+ <xs:element name="month" type="t:month-test"/>
+ <xs:element name="year" type="t:year-test"/>
+ <xs:element name="month-day" type="t:month-day-test"/>
+ <xs:element name="year-month" type="t:year-month-test"/>
+ </xs:sequence>
+
+<!--
+ <xs:attribute name="any" type="xs:anySimpleType" default=""/>
+-->
+
+ <xs:attribute name="bool1" type="xs:boolean" default="true"/>
+ <xs:attribute name="bool2" type="xs:boolean" default="1"/>
+ <xs:attribute name="bool3" type="xs:boolean" default="false"/>
+ <xs:attribute name="bool4" type="xs:boolean" default="0"/>
+
+ <xs:attribute name="byte" type="xs:byte" default="-99"/>
+ <xs:attribute name="ubyte" type="xs:unsignedByte" default="99"/>
+ <xs:attribute name="short" type="xs:short" default="-999"/>
+ <xs:attribute name="ushort" type="xs:unsignedShort" default="999"/>
+ <xs:attribute name="int" type="xs:int" default="-99999"/>
+ <xs:attribute name="uint" type="xs:unsignedInt" default="99999"/>
+ <xs:attribute name="long" type="xs:long" default="-99999"/>
+ <xs:attribute name="ulong" type="xs:unsignedLong" default="99999"/>
+
+ <xs:attribute name="integer" type="xs:integer" default="-99999"/>
+ <xs:attribute name="npinteger" type="xs:nonPositiveInteger" default="-99999"/>
+ <xs:attribute name="nninteger" type="xs:nonNegativeInteger" default="99999"/>
+ <xs:attribute name="pinteger" type="xs:positiveInteger" default="99999"/>
+ <xs:attribute name="ninteger" type="xs:negativeInteger" default="-99999"/>
+
+ <xs:attribute name="float1" type="xs:float" default="1.123"/>
+ <xs:attribute name="float2" type="xs:float" default="1.123e3"/>
+ <xs:attribute name="float3" type="xs:float" default="-.123E-3"/>
+ <xs:attribute name="float4" type="xs:float" default="NaN"/>
+ <xs:attribute name="float5" type="xs:float" default="-INF"/>
+
+ <xs:attribute name="double1" type="xs:double" default="1.12345"/>
+ <xs:attribute name="double2" type="xs:double" default="1.12345e3"/>
+ <xs:attribute name="double3" type="xs:double" default="-.12345E-3"/>
+ <xs:attribute name="double4" type="xs:double" default="NaN"/>
+ <xs:attribute name="double5" type="xs:double" default="-INF"/>
+
+ <xs:attribute name="decimal1" type="xs:decimal" default="1.12345"/>
+ <xs:attribute name="decimal2" type="xs:decimal" default="-.456"/>
+
+ <xs:attribute name="string1" type="xs:string" default=""/>
+ <xs:attribute name="string2" type="xs:string" default=" a b "/>
+ <xs:attribute name="nstring" type="xs:normalizedString" default=" a b "/>
+ <xs:attribute name="token" type="xs:token" default=" a b "/>
+ <xs:attribute name="nmtoken" type="xs:NMTOKEN" default="ab:cd"/>
+ <xs:attribute name="nmtokens1" type="xs:NMTOKENS" default=" a:b efg aaa "/>
+ <xs:attribute name="nmtokens2" type="xs:NMTOKENS" default="abc"/>
+ <xs:attribute name="ncname" type="xs:NCName" default=" abcd "/>
+ <xs:attribute name="language" type="xs:language" default=" en-us "/>
+ <xs:attribute name="id" type="xs:ID"/>
+ <xs:attribute name="idref" type="xs:IDREF" default="this"/>
+ <xs:attribute name="idrefs" type="xs:IDREFS" default=" this "/>
+ <xs:attribute name="uri" type="xs:anyURI" default=" http://example.com "/>
+
+ <xs:attribute name="qname1" type="xs:QName" default="foo"/>
+ <xs:attribute name="qname2" type="xs:QName" default="t:bar"/>
+
+ <xs:attribute name="base64_bin1" type="xs:base64Binary" default=""/>
+ <xs:attribute name="base64_bin2" type="xs:base64Binary" default="YmFzZTY0IGJpbmFyeQ=="/>
+
+ <xs:attribute name="hex_bin1" type="xs:hexBinary" default=""/>
+ <xs:attribute name="hex_bin2" type="xs:hexBinary" default="6865782052696E617279"/>
+
+ <!-- fixed -->
+
+ <xs:attribute name="fix1" type="xs:int" fixed="123"/>
+ <xs:attribute name="fix2" type="xs:int" fixed="123" use="required"/>
+ <xs:attribute name="fix3" type="xs:string" fixed="abc"/>
+ <xs:attribute name="fix4" type="xs:string" fixed="abc" use="required"/>
+ <xs:attribute name="fix5" type="xs:NMTOKENS" fixed="aaa bbb ccc"/>
+ <xs:attribute name="fix6" type="xs:NMTOKENS" fixed="aaa bbb ccc" use="required"/>
+
+ </xs:complexType>
+
+ <xs:element name="root" type="t:type"/>
+
+</xs:schema>
diff --git a/xsd-tests/cxx/tree/default/omit/buildfile b/xsd-tests/cxx/tree/default/omit/buildfile
new file mode 100644
index 0000000..407ab1e
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/omit/buildfile
@@ -0,0 +1,27 @@
+# file : cxx/tree/default/omit/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-ostream \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --omit-default-attributes \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/default/omit/driver.cxx b/xsd-tests/cxx/tree/default/omit/driver.cxx
new file mode 100644
index 0000000..3dcc0d8
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/omit/driver.cxx
@@ -0,0 +1,46 @@
+// file : cxx/tree/default/omit/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test default attribute omission from the output.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1], xml_schema::flags::dont_validate));
+
+ cout << *r << endl
+ << "default x: " << derived::x_default_value () << endl
+ << "default y: " << derived::y_default_value () << endl
+ << "fixed p: " << derived::p_default_value () << endl
+ << "fixed q1: " << derived::q1_default_value () << endl
+ << "fixed q2: " << derived::q2_default_value () << endl;
+
+ // Serialize.
+ //
+ xml_schema::namespace_infomap map;
+ map["t"].name = "test";
+ root (cout, *r, map);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/default/omit/output b/xsd-tests/cxx/tree/default/omit/output
new file mode 100644
index 0000000..150ad58
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/omit/output
@@ -0,0 +1,19 @@
+
+derived:
+a: a
+x: foo
+q1: 1
+y: -20
+p: bar
+q2: 2
+default x: foo
+default y: -20
+fixed p: bar
+fixed q1: 1
+fixed q2: 2
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test">
+ <derived q1="1" q2="2">
+ <a>a</a>
+ </derived>
+</t:root>
diff --git a/xsd-tests/cxx/tree/default/omit/test.xml b/xsd-tests/cxx/tree/default/omit/test.xml
new file mode 100644
index 0000000..dec39b4
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/omit/test.xml
@@ -0,0 +1,9 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <derived q1="1" q2="2">
+ <a>a</a>
+ </derived>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/default/omit/test.xsd b/xsd-tests/cxx/tree/default/omit/test.xsd
new file mode 100644
index 0000000..bfc68d4
--- /dev/null
+++ b/xsd-tests/cxx/tree/default/omit/test.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="x" type="string" default="foo"/>
+ <attribute name="q1" type="int" fixed="1" use="required"/>
+ </complexType>
+
+ <complexType name="derived">
+ <complexContent>
+ <extension base="t:base">
+ <attribute name="y" type="int" default="-20"/>
+ <attribute name="p" type="string" fixed="bar"/>
+ <attribute name="q2" type="int" fixed="2" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="derived" type="t:derived"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/detach/buildfile b/xsd-tests/cxx/tree/detach/buildfile
new file mode 100644
index 0000000..07f5f03
--- /dev/null
+++ b/xsd-tests/cxx/tree/detach/buildfile
@@ -0,0 +1,21 @@
+# file : cxx/tree/detach/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-detach \
+ --generate-default-ctor \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/detach/driver.cxx b/xsd-tests/cxx/tree/detach/driver.cxx
new file mode 100644
index 0000000..b632b5d
--- /dev/null
+++ b/xsd-tests/cxx/tree/detach/driver.cxx
@@ -0,0 +1,108 @@
+// file : cxx/tree/detach/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the detach functionality.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+
+#include "test.hxx"
+
+#ifdef XSD_CXX11
+# include <utility> // std::move
+# define XSD_MOVE(x) std::move(x)
+#else
+# define XSD_MOVE(x) x
+#endif
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ using test::ref;
+
+ // Construct the model.
+ //
+ object o1 ("o1");
+ o1.data ().push_back ("1-1");
+ o1.data ().push_back ("1-2");
+ o1.data ().push_back ("1-3");
+
+ object o2 ("o2");
+ o1.data ().push_back ("2-1");
+ o1.data ().push_back ("2-2");
+ o1.data ().push_back ("2-3");
+
+ object o3 ("o3");
+ o1.data ().push_back ("3-1");
+ o1.data ().push_back ("3-2");
+ o1.data ().push_back ("3-3");
+
+ object o4 ("o4");
+ o1.data ().push_back ("4-1");
+ o1.data ().push_back ("4-2");
+ o1.data ().push_back ("4-3");
+
+ subtree s1;
+ s1.o ().push_back (o1);
+ s1.o ().push_back (o2);
+ s1.r ().push_back (ref ("o2"));
+ s1.r ().push_back (ref ("o3"));
+
+ subtree s2;
+ s2.o ().push_back (o3);
+ s2.o ().push_back (o4);
+ s2.r ().push_back (ref ("o4"));
+ s2.r ().push_back (ref ("o1"));
+
+ model m;
+ m.one (s1);
+ m.opt (s2);
+
+ // Detach one.
+ //
+ XSD_AUTO_PTR<subtree> p (m.detach_one ());
+ assert (p->_container () == 0);
+ assert (p->r ()[0].get () == &p->o ()[1]);
+ assert (m.opt ()->r ()[1].get () == 0);
+
+ m.one (XSD_MOVE (p));
+ assert (m.opt ()->r ()[1].get () == &m.one ().o ()[0]);
+ p = m.detach_one ();
+
+ model m1;
+ m1.one (XSD_MOVE (p));
+ m1.opt (s2);
+ assert (m1.opt ()->r ()[1].get () == &m1.one ().o ()[0]);
+
+ p = m1.detach_one ();
+ m.seq ().push_back (XSD_MOVE (p));
+
+ // Detach opt.
+ //
+ p = m.opt ().detach ();
+ assert (!m.opt ());
+ assert (p->_container () == 0);
+ assert (p->r ()[0].get () == &p->o ()[1]);
+ assert (m.seq ()[0].r ()[1].get () == 0);
+
+ m.seq ().push_back (XSD_MOVE (p));
+
+ // Detach seq.
+ //
+ p = m.seq ().detach_back ();
+ assert (p->_container () == 0);
+ assert (p->r ()[0].get () == &p->o ()[1]);
+ assert (m.seq ()[0].r ()[1].get () == 0);
+
+ m.seq ().push_back (XSD_MOVE (p));
+ assert (m.seq ()[0].r ()[1].get () == &m.seq ()[1].o ()[0]);
+
+ m.seq ().detach (m.seq ().begin (), p);
+ assert (p->_container () == 0);
+ assert (p->r ()[0].get () == &p->o ()[1]);
+ assert (m.seq ()[0].r ()[1].get () == 0);
+}
diff --git a/xsd-tests/cxx/tree/detach/test.xsd b/xsd-tests/cxx/tree/detach/test.xsd
new file mode 100644
index 0000000..b9f5166
--- /dev/null
+++ b/xsd-tests/cxx/tree/detach/test.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="object">
+ <sequence>
+ <element name="data" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="ID" use="required"/>
+ </complexType>
+
+ <complexType name="ref">
+ <simpleContent>
+ <extension base="IDREF"/>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="subtree">
+ <sequence>
+ <element name="o" type="t:object" minOccurs="0" maxOccurs="unbounded"/>
+ <element name="r" type="t:ref" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="model">
+ <sequence>
+ <element name="one" type="t:subtree"/>
+ <element name="opt" type="t:subtree" minOccurs="0"/>
+ <element name="seq" type="t:subtree" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/dom-association/buildfile b/xsd-tests/cxx/tree/dom-association/buildfile
new file mode 100644
index 0000000..85593e5
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/buildfile
@@ -0,0 +1,27 @@
+# file : cxx/tree/dom-association/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-ostream \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
+
+# Define XSD_CXX11 since we include libxsd headers directly.
+#
+cxx.poptions += -DXSD_CXX11
diff --git a/xsd-tests/cxx/tree/dom-association/dom-parse.cxx b/xsd-tests/cxx/tree/dom-association/dom-parse.cxx
new file mode 100644
index 0000000..281eb2c
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/dom-parse.cxx
@@ -0,0 +1,95 @@
+// file : cxx/tree/dom-association/dom-parse.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "dom-parse.hxx"
+
+#include <istream>
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/util/XMLUniDefs.hpp> // chLatin_*
+#include <xercesc/framework/Wrapper4InputSource.hpp>
+
+#include <xsd/cxx/xml/sax/std-input-source.hxx>
+#include <xsd/cxx/xml/dom/bits/error-handler-proxy.hxx>
+
+#include <xsd/cxx/tree/exceptions.hxx>
+#include <xsd/cxx/tree/error-handler.hxx>
+
+using namespace xercesc;
+namespace xml = xsd::cxx::xml;
+namespace tree = xsd::cxx::tree;
+
+XSD_DOM_AUTO_PTR<DOMDocument>
+parse (std::istream& is,
+ const std::string& id,
+ bool validate)
+{
+ const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull};
+
+ // Get an implementation of the Load-Store (LS) interface.
+ //
+ DOMImplementation* impl (
+ DOMImplementationRegistry::getDOMImplementation (ls_id));
+
+ XSD_DOM_AUTO_PTR<DOMLSParser> parser (
+ impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0));
+
+ DOMConfiguration* conf (parser->getDomConfig ());
+
+ // Discard comment nodes in the document.
+ //
+ conf->setParameter (XMLUni::fgDOMComments, false);
+
+ // Enable datatype normalization.
+ //
+ conf->setParameter (XMLUni::fgDOMDatatypeNormalization, true);
+
+ // Do not create EntityReference nodes in the DOM tree. No
+ // EntityReference nodes will be created, only the nodes
+ // corresponding to their fully expanded substitution text
+ // will be created.
+ //
+ conf->setParameter (XMLUni::fgDOMEntities, false);
+
+ // Perform namespace processing.
+ //
+ conf->setParameter (XMLUni::fgDOMNamespaces, true);
+
+ // Do not include ignorable whitespace in the DOM tree.
+ //
+ conf->setParameter (XMLUni::fgDOMElementContentWhitespace, false);
+
+ // Enable/Disable validation.
+ //
+ conf->setParameter (XMLUni::fgDOMValidate, validate);
+ conf->setParameter (XMLUni::fgXercesSchema, validate);
+ conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false);
+
+ // Xerces-C++ 3.1.0 is the first version with working multi import
+ // support.
+ //
+#if _XERCES_VERSION >= 30100
+ conf->setParameter (XMLUni::fgXercesHandleMultipleImports, true);
+#endif
+
+ // We will release the DOM document ourselves.
+ //
+ conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true);
+
+ // Set error handler.
+ //
+ tree::error_handler<char> eh;
+ xml::dom::bits::error_handler_proxy<char> ehp (eh);
+ conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp);
+
+ // Prepare input stream.
+ //
+ xml::sax::std_input_source isrc (is, id);
+ Wrapper4InputSource wrap (&isrc, false);
+
+ XSD_DOM_AUTO_PTR<DOMDocument> doc (parser->parse (&wrap));
+
+ eh.throw_if_failed<tree::parsing<char> > ();
+
+ return doc;
+}
diff --git a/xsd-tests/cxx/tree/dom-association/dom-parse.hxx b/xsd-tests/cxx/tree/dom-association/dom-parse.hxx
new file mode 100644
index 0000000..f14a53b
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/dom-parse.hxx
@@ -0,0 +1,23 @@
+// file : cxx/tree/dom-association/dom-parse.hxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef DOM_PARSE
+#define DOM_PARSE
+
+#include <string>
+#include <iosfwd>
+
+#include <xercesc/dom/DOMDocument.hpp>
+
+#include <xsd/cxx/xml/dom/auto-ptr.hxx>
+
+// Parse an XML document from the standard input stream with an
+// optional resource id. Resource id is used in diagnostics as
+// well as to locate schemas referenced from inside the document.
+//
+XSD_DOM_AUTO_PTR<xercesc::DOMDocument>
+parse (std::istream& is,
+ const std::string& id,
+ bool validate);
+
+#endif // DOM_PARSE
diff --git a/xsd-tests/cxx/tree/dom-association/driver.cxx b/xsd-tests/cxx/tree/dom-association/driver.cxx
new file mode 100644
index 0000000..d85e105
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/driver.cxx
@@ -0,0 +1,71 @@
+// file : cxx/tree/dom-association/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test DOM association/ownership.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <fstream>
+#include <iostream>
+
+#include <xercesc/dom/DOM.hpp>
+
+#include "dom-parse.hxx"
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+using namespace xercesc;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ int r (0);
+
+ XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ ifstream ifs;
+ ifs.exceptions (ifstream::badbit | ifstream::failbit);
+ ifs.open (argv[1]);
+
+ DOMDocument* ptr;
+
+#ifdef XSD_CXX11
+ xml_schema::dom::unique_ptr<DOMDocument> doc (parse (ifs, argv[1], true));
+ ptr = doc.get ();
+ unique_ptr<type> r (
+ root (std::move (doc),
+ xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
+#else
+ xml_schema::dom::auto_ptr<DOMDocument> doc (parse (ifs, argv[1], true));
+ ptr = doc.get ();
+ auto_ptr<type> r (
+ root (doc,
+ xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
+#endif
+
+ assert (doc.get () == 0);
+ assert (r->_node ()->getOwnerDocument () == ptr);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ r = 1;
+ }
+ catch (const std::ios_base::failure&)
+ {
+ cerr << argv[1] << ": unable to open or read failure" << endl;
+ r = 1;
+ }
+
+ XMLPlatformUtils::Terminate ();
+ return r;
+}
diff --git a/xsd-tests/cxx/tree/dom-association/output b/xsd-tests/cxx/tree/dom-association/output
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/output
diff --git a/xsd-tests/cxx/tree/dom-association/test.xml b/xsd-tests/cxx/tree/dom-association/test.xml
new file mode 100644
index 0000000..624a80c
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/test.xml
@@ -0,0 +1,7 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>a</a>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/dom-association/test.xsd b/xsd-tests/cxx/tree/dom-association/test.xsd
new file mode 100644
index 0000000..07bebc7
--- /dev/null
+++ b/xsd-tests/cxx/tree/dom-association/test.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile
new file mode 100644
index 0000000..bdea527
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/encoding/char/iso-8859-1/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --char-encoding iso8859-1 \
+ --generate-doxygen \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx
new file mode 100644
index 0000000..e356815
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/driver.cxx
@@ -0,0 +1,74 @@
+// file : cxx/tree/encoding/char/iso-8859-1/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test ISO-8859-1 encoding.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <fstream>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ try
+ {
+ root (argv[1]);
+ return 1;
+ }
+ catch (xsd::cxx::xml::iso8859_1_unrepresentable const&)
+ {
+ }
+
+ xsd::cxx::xml::char_transcoder::unrep_char ('?');
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ {
+ type::a_sequence const& s (r->a ());
+
+ if (s[0] != "abc" ||
+ s[1] != "\xE6" ||
+ s[2] != "\xA2\xA3\xA4\xA5" ||
+ s[3] != "??")
+ {
+ cerr << "invalid encoding" << endl;
+ return 1;
+ }
+ }
+
+ {
+ type::b_sequence const& s (r->b ());
+
+ if (s[0] != strenum::abc ||
+ s[1] != strenum::a_c ||
+ s[2] != strenum::cxx__bc)
+ {
+ cerr << "invalid encoding" << endl;
+ return 1;
+ }
+ }
+
+ xml_schema::namespace_infomap map;
+ map["t"].name = "test";
+
+ root (std::cout, *r, map, "ISO-8859-1");
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << "xml_schema::exception: " << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/output b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/output
new file mode 100644
index 0000000..cb73faa
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/output
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
+<t:root xmlns:t="test">
+ <a>abc</a>
+ <a>æ</a>
+ <a>¢£¤¥</a>
+ <a>??</a>
+ <b>abc</b>
+ <b>aâc</b>
+ <b>âòbc</b>
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml
new file mode 100644
index 0000000..cc05f8d
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xml
@@ -0,0 +1,14 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>abc</a>
+ <a>&#xE6;</a>
+ <a>&#xA2;&#xA3;&#xA4;&#xA5;</a>
+ <a>&#x100;&#xAAAA;</a>
+
+ <b>abc</b>
+ <b>a&#xE2;c</b>
+ <b>&#xE2;&#xF2;bc</b>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd
new file mode 100644
index 0000000..31b8901
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/iso-8859-1/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="strenum">
+
+ <annotation>
+ <documentation>
+ Test enum. Valid values are:
+ abc
+ a&#xE2;c
+ &#xF2;bc
+ </documentation>
+ </annotation>
+
+ <restriction base="string">
+ <enumeration value="abc"/>
+ <enumeration value="a&#xE2;c"/>
+ <enumeration value="&#xE2;&#xF2;bc"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string" maxOccurs="unbounded"/>
+ <element name="b" type="t:strenum" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/buildfile b/xsd-tests/cxx/tree/encoding/char/lcp/buildfile
new file mode 100644
index 0000000..d935b09
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/lcp/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/tree/encoding/char/lcp/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --char-encoding lcp \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx b/xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx
new file mode 100644
index 0000000..97c0875
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/lcp/driver.cxx
@@ -0,0 +1,40 @@
+// file : cxx/tree/encoding/char/lcp/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test local code page encoding (--char-encoding lcp).
+// The test just makes sure it still compiles and works.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <fstream>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ xml_schema::namespace_infomap map;
+ map["t"].name = "test";
+
+ root (std::cout, *r, map);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << "xml_schema::exception: " << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/output b/xsd-tests/cxx/tree/encoding/char/lcp/output
new file mode 100644
index 0000000..368826d
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/lcp/output
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test">
+ <a>abcd</a>
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/test.xml b/xsd-tests/cxx/tree/encoding/char/lcp/test.xml
new file mode 100644
index 0000000..772512e
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/lcp/test.xml
@@ -0,0 +1,7 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>abcd</a>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/char/lcp/test.xsd b/xsd-tests/cxx/tree/encoding/char/lcp/test.xsd
new file mode 100644
index 0000000..1e264e3
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/lcp/test.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/buildfile b/xsd-tests/cxx/tree/encoding/char/utf-8/buildfile
new file mode 100644
index 0000000..4d48165
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/utf-8/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/tree/encoding/char/utf-8/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-doxygen \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx b/xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx
new file mode 100644
index 0000000..7892667
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/utf-8/driver.cxx
@@ -0,0 +1,63 @@
+// file : cxx/tree/encoding/char/utf-8/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test UTF-8 encoding.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <fstream>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ {
+ type::a_sequence const& s (r->a ());
+
+ if (s[0] != "abc" ||
+ s[1] != "\xD5\x95" ||
+ s[2] != "\xEA\xAA\xAA")
+ {
+ cerr << "invalid encoding" << endl;
+ return 1;
+ }
+ }
+
+ {
+ type::b_sequence const& s (r->b ());
+
+ if (s[0] != strenum::abc ||
+ s[1] != strenum::a_c ||
+ s[2] != strenum::cxx_bc)
+ {
+ cerr << "invalid encoding" << endl;
+ return 1;
+ }
+ }
+
+ xml_schema::namespace_infomap map;
+ map["t"].name = "test";
+
+ root (std::cout, *r, map, "ASCII");
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << "xml_schema::exception: " << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/output b/xsd-tests/cxx/tree/encoding/char/utf-8/output
new file mode 100644
index 0000000..fdfef4c
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/utf-8/output
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII" standalone="no" ?>
+<t:root xmlns:t="test">
+ <a>abc</a>
+ <a>&#x555;</a>
+ <a>&#xAAAA;</a>
+ <b>abc</b>
+ <b>a&#x555;c</b>
+ <b>&#xAAAA;bc</b>
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/test.xml b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xml
new file mode 100644
index 0000000..0d3e27a
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xml
@@ -0,0 +1,13 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>abc</a>
+ <a>&#x555;</a>
+ <a>&#xAAAA;</a>
+
+ <b>abc</b>
+ <b>a&#x555;c</b>
+ <b>&#xAAAA;bc</b>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd
new file mode 100644
index 0000000..d5ee868
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/char/utf-8/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="strenum">
+
+ <annotation>
+ <documentation>
+ Test enum. Valid values are:
+ abc
+ a&#x555;c
+ &#xAAAA;bc
+ </documentation>
+ </annotation>
+
+ <restriction base="string">
+ <enumeration value="abc"/>
+ <enumeration value="a&#x555;c"/>
+ <enumeration value="&#xAAAA;bc"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string" maxOccurs="unbounded"/>
+ <element name="b" type="t:strenum" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/encoding/wchar/buildfile b/xsd-tests/cxx/tree/encoding/wchar/buildfile
new file mode 100644
index 0000000..f640976
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/wchar/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/encoding/wchar/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --char-type wchar_t \
+ --generate-doxygen \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/encoding/wchar/driver.cxx b/xsd-tests/cxx/tree/encoding/wchar/driver.cxx
new file mode 100644
index 0000000..dbcbcba
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/wchar/driver.cxx
@@ -0,0 +1,55 @@
+// file : cxx/tree/encoding/wchar/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test the wide character mapping.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <fstream>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ // Use dont_validate because we do not have instance's system id (path).
+ //
+ std::ifstream ifs (argv[1]);
+ XSD_AUTO_PTR<type> r (root (ifs, xml_schema::flags::dont_validate));
+
+ {
+ type::b_sequence const& s (r->b ());
+
+ if (s[0] != strenum::abc ||
+ s[1] != strenum::a__c ||
+ s[2] != strenum::cxx__bc ||
+ s[3] != strenum::ab__)
+ {
+ cerr << "invalid encoding" << endl;
+ return 1;
+ }
+ }
+
+ xml_schema::namespace_infomap map;
+ map[L"t"].name = L"test";
+
+ root (std::cout, *r, map, L"ASCII");
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << "xml_schema::exception: " << e.what () << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/encoding/wchar/output b/xsd-tests/cxx/tree/encoding/wchar/output
new file mode 100644
index 0000000..e0eaef0
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/wchar/output
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII" standalone="no" ?>
+<t:root xmlns:t="test">
+ <a>abc</a>
+ <a>&#x1FFF;&#xD7FF;</a>
+ <a>&#x1000;&#x10FF;</a>
+ <b>abc</b>
+ <b>a&#x1FFF;&#xD7FF;c</b>
+ <b>&#x1000;&#x10FF;bc</b>
+ <b>ab&#x1000;&#x10FF;</b>
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/wchar/test.xml b/xsd-tests/cxx/tree/encoding/wchar/test.xml
new file mode 100644
index 0000000..9abb1b6
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/wchar/test.xml
@@ -0,0 +1,14 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>abc</a>
+ <a>&#x1FFF;&#xD7FF;</a>
+ <a>&#x1000;&#x10FF;</a>
+
+ <b>abc</b>
+ <b>a&#x1FFF;&#xD7FF;c</b>
+ <b>&#x1000;&#x10FF;bc</b>
+ <b>ab&#x1000;&#x10FF;</b>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/encoding/wchar/test.xsd b/xsd-tests/cxx/tree/encoding/wchar/test.xsd
new file mode 100644
index 0000000..0151d2f
--- /dev/null
+++ b/xsd-tests/cxx/tree/encoding/wchar/test.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="strenum">
+
+ <annotation>
+ <documentation>
+ Test enum. Valid values are:
+ abc
+ a&#x1FFF;&#xD7FF;c
+ &#x1000;&#x10FF;bc
+ ab&#x1000;&#x10FF;
+ </documentation>
+ </annotation>
+
+ <restriction base="string">
+ <enumeration value="abc"/>
+ <enumeration value="a&#x1FFF;&#xD7FF;c"/>
+ <enumeration value="&#x1000;&#x10FF;bc"/>
+ <enumeration value="ab&#x1000;&#x10FF;"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string" maxOccurs="unbounded"/>
+ <element name="b" type="t:strenum" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/enumeration/ctor/buildfile b/xsd-tests/cxx/tree/enumeration/ctor/buildfile
new file mode 100644
index 0000000..96be1ce
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/ctor/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/tree/enumeration/ctor/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --generate-doxygen \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/enumeration/ctor/driver.cxx b/xsd-tests/cxx/tree/enumeration/ctor/driver.cxx
new file mode 100644
index 0000000..c5ea1f2
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/ctor/driver.cxx
@@ -0,0 +1,30 @@
+// file : cxx/tree/enumeration/ctor/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test enumeration constructors.
+//
+#include <string>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ // Test ctor(const char*).
+ //
+ {
+ string_enum se ("a");
+ type t ("a", 1);
+ }
+
+ // Test ctor(const std::string&)
+ //
+ {
+ string const s ("c");
+ string_enum se (s);
+ type t (s, 3);
+ }
+}
diff --git a/xsd-tests/cxx/tree/enumeration/ctor/test.xsd b/xsd-tests/cxx/tree/enumeration/ctor/test.xsd
new file mode 100644
index 0000000..c5d625a
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/ctor/test.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="string-enum-base">
+ <restriction base="string">
+ <enumeration value="a"/>
+ <enumeration value="b"/>
+ <enumeration value="c"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="string-enum">
+ <restriction base="t:string-enum-base">
+ <enumeration value="a"/>
+ <enumeration value="c"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="int-enum-base">
+ <restriction base="int">
+ <enumeration value="1"/>
+ <enumeration value="2"/>
+ <enumeration value="3"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="int-enum">
+ <restriction base="t:int-enum-base">
+ <enumeration value="1"/>
+ <enumeration value="3"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="t:string-enum"/>
+ <element name="b" type="t:int-enum"/>
+ </sequence>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/buildfile b/xsd-tests/cxx/tree/enumeration/inheritance/buildfile
new file mode 100644
index 0000000..184c95c
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/inheritance/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/tree/enumeration/inheritance/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-ostream \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx b/xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx
new file mode 100644
index 0000000..b517b1f
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/inheritance/driver.cxx
@@ -0,0 +1,53 @@
+// file : cxx/tree/enumeration/inheritance/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Insert test description here.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<top_bottom> r (root (argv[1]));
+
+ switch (*r)
+ {
+ case top_bottom::top:
+ {
+ cout << "top" << endl;
+ break;
+ }
+ case top_bottom::bottom:
+ {
+ cout << "bottom" << endl;
+ break;
+ }
+ default: // Suppress warning.
+ {
+ assert (false);
+ break;
+ }
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/output b/xsd-tests/cxx/tree/enumeration/inheritance/output
new file mode 100644
index 0000000..fef12e2
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/inheritance/output
@@ -0,0 +1 @@
+bottom
diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/test.xml b/xsd-tests/cxx/tree/enumeration/inheritance/test.xml
new file mode 100644
index 0000000..1de9043
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/inheritance/test.xml
@@ -0,0 +1,3 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">bottom</t:root>
diff --git a/xsd-tests/cxx/tree/enumeration/inheritance/test.xsd b/xsd-tests/cxx/tree/enumeration/inheritance/test.xsd
new file mode 100644
index 0000000..cf2eeb1
--- /dev/null
+++ b/xsd-tests/cxx/tree/enumeration/inheritance/test.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="side">
+ <restriction base="string">
+ <enumeration value="top"/>
+ <enumeration value="left"/>
+ <enumeration value="bottom"/>
+ <enumeration value="right"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="top-bottom">
+ <restriction base="t:side">
+ <enumeration value="top"/>
+ <enumeration value="bottom"/>
+ </restriction>
+ </simpleType>
+
+ <element name="root" type="t:top-bottom"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/float/buildfile b/xsd-tests/cxx/tree/float/buildfile
new file mode 100644
index 0000000..4872a2f
--- /dev/null
+++ b/xsd-tests/cxx/tree/float/buildfile
@@ -0,0 +1,24 @@
+# file : cxx/tree/float/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/float/driver.cxx b/xsd-tests/cxx/tree/float/driver.cxx
new file mode 100644
index 0000000..0f7455f
--- /dev/null
+++ b/xsd-tests/cxx/tree/float/driver.cxx
@@ -0,0 +1,53 @@
+// file : cxx/tree/float/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test floating point (xsd:{float, double, decimal}) type parsing
+// and serialization.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ r->simple ().push_back (12.129456);
+ r->simple ().push_back (123.129456);
+ r->simple ().push_back (1234.129456);
+
+ r->s (12.129456);
+
+ r->complex ().push_back (12.129456);
+ r->complex ().push_back (123.129456);
+ r->complex ().push_back (1234.129456);
+ r->complex ().push_back (-12.12);
+ r->complex ().push_back (-123.12);
+
+ r->s (12.129456);
+
+ xml_schema::namespace_infomap map;
+
+ map["t"].name = "test";
+ root (cout, *r, map);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/float/output b/xsd-tests/cxx/tree/float/output
new file mode 100644
index 0000000..399e28c
--- /dev/null
+++ b/xsd-tests/cxx/tree/float/output
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test" de="0" do="0" f="0" s="12.13">
+ <float>0</float>
+ <float>1</float>
+ <float>1e+06</float>
+ <float>1e-07</float>
+ <float-list>0 1 1e+06 1e-07</float-list>
+ <double>0</double>
+ <double>1</double>
+ <double>100000000000000</double>
+ <double>1e-15</double>
+ <double-list>0 1 100000000000000 1e-15</double-list>
+ <decimal>0</decimal>
+ <decimal>1</decimal>
+ <decimal>10000</decimal>
+ <decimal>100000000000000</decimal>
+ <decimal>0.000000000000001</decimal>
+ <decimal-list>0 1 100000000000000 0.000000000000001</decimal-list>
+ <simple>0</simple>
+ <simple>1</simple>
+ <simple>12.34</simple>
+ <simple>0.12</simple>
+ <simple>12.13</simple>
+ <simple>123.1</simple>
+ <simple>1234</simple>
+ <complex>0</complex>
+ <complex>1</complex>
+ <complex>12.34</complex>
+ <complex>0.12</complex>
+ <complex>12.13</complex>
+ <complex>123.1</complex>
+ <complex>1234</complex>
+ <complex>-12.12</complex>
+ <complex>-123.1</complex>
+</t:root>
diff --git a/xsd-tests/cxx/tree/float/test.xml b/xsd-tests/cxx/tree/float/test.xml
new file mode 100644
index 0000000..e5124a4
--- /dev/null
+++ b/xsd-tests/cxx/tree/float/test.xml
@@ -0,0 +1,35 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+ f="0.0" do="0.0" de="0.0">
+
+ <float>0.0</float>
+ <float>1.0</float>
+ <float>1000000.0</float>
+ <float>0.0000001</float>
+ <float-list>0.0 1.0 1000000.0 0.0000001</float-list>
+
+ <double>0.0</double>
+ <double>1.0</double>
+ <double>100000000000000.0</double>
+ <double>0.000000000000001</double>
+ <double-list>0.0 1.0 100000000000000.0 0.000000000000001</double-list>
+
+ <decimal>0.0</decimal>
+ <decimal>1.0</decimal>
+ <decimal>10000</decimal>
+ <decimal>100000000000000.0</decimal>
+ <decimal>0.000000000000001</decimal>
+ <decimal-list>0.0 1.0 100000000000000.0 0.000000000000001</decimal-list>
+
+ <simple>0.0</simple>
+ <simple>1.0</simple>
+ <simple>12.34</simple>
+ <simple>0.12</simple>
+
+ <complex>0.0</complex>
+ <complex>1.0</complex>
+ <complex>12.34</complex>
+ <complex>0.12</complex>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/float/test.xsd b/xsd-tests/cxx/tree/float/test.xsd
new file mode 100644
index 0000000..c02678d
--- /dev/null
+++ b/xsd-tests/cxx/tree/float/test.xsd
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="float-list">
+ <list itemType="float"/>
+ </simpleType>
+
+ <simpleType name="double-list">
+ <list itemType="double"/>
+ </simpleType>
+
+ <simpleType name="decimal-list">
+ <list itemType="decimal"/>
+ </simpleType>
+
+ <!-- decimal facets -->
+
+ <simpleType name="simple">
+ <restriction base="t:base-simple">
+ <fractionDigits value="2"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="base-simple">
+ <restriction base="decimal">
+ <totalDigits value="4"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="complex">
+ <simpleContent>
+ <restriction base="t:base-complex">
+ <fractionDigits value="2"/>
+ <totalDigits value="4"/>
+ <attribute name="x" type="int"/>
+ </restriction>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="base-complex">
+ <simpleContent>
+ <extension base="decimal">
+ <attribute name="x" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+
+ <complexType name="type">
+ <sequence>
+ <element name="float" type="float" maxOccurs="unbounded"/>
+ <element name="float-list" type="t:float-list"/>
+ <element name="double" type="double" maxOccurs="unbounded"/>
+ <element name="double-list" type="t:double-list"/>
+ <element name="decimal" type="decimal" maxOccurs="unbounded"/>
+ <element name="decimal-list" type="t:decimal-list"/>
+
+ <element name="simple" type="t:simple" maxOccurs="unbounded"/>
+ <element name="complex" type="t:complex" maxOccurs="unbounded"/>
+
+ </sequence>
+ <attribute name="f" type="float" default="12.34"/>
+ <attribute name="do" type="double" default="1234.1234"/>
+ <attribute name="de" type="decimal" default="1234.1234"/>
+
+ <attribute name="s" type="t:simple"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+ <element name="double" type="double"/>
+ <element name="decimal" type="decimal"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/list/ctor/buildfile b/xsd-tests/cxx/tree/list/ctor/buildfile
new file mode 100644
index 0000000..2155f95
--- /dev/null
+++ b/xsd-tests/cxx/tree/list/ctor/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/tree/list/ctor/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --generate-doxygen \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/list/ctor/driver.cxx b/xsd-tests/cxx/tree/list/ctor/driver.cxx
new file mode 100644
index 0000000..5673e67
--- /dev/null
+++ b/xsd-tests/cxx/tree/list/ctor/driver.cxx
@@ -0,0 +1,50 @@
+// file : cxx/tree/list/ctor/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test list constructors.
+//
+#include <string>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ // Test ctor()
+ //
+ {
+ string_list sl;
+
+ xml_schema::nmtokens nt;
+ xml_schema::idrefs id;
+ }
+
+ // Test ctor(size_type, const X&)
+ //
+ {
+ string_list sl (10, "abc");
+ size_type st (10, 123);
+
+ xml_schema::nmtokens nt (10, "abc");
+ xml_schema::idrefs id (10, "abc");
+ }
+
+ // Test ctor(const I& begin, const I& end)
+ //
+ {
+ string_list sl1 (10, "abc");
+ string_list sl2 (sl1.begin (), sl1.end ());
+
+ I i1 (10, 123);
+ I i2 (i1.begin (), i1.end ());
+
+ xml_schema::nmtokens nt1 (10, "abc");
+ xml_schema::nmtokens nt2 (nt1.begin (), nt1.end ());
+
+ xml_schema::idrefs id1 (10, "abc");
+ xml_schema::idrefs id2 (id1.begin (), id1.end ());
+ }
+}
diff --git a/xsd-tests/cxx/tree/list/ctor/test.xsd b/xsd-tests/cxx/tree/list/ctor/test.xsd
new file mode 100644
index 0000000..f090bb8
--- /dev/null
+++ b/xsd-tests/cxx/tree/list/ctor/test.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="string-list">
+ <list itemType="string"/>
+ </simpleType>
+
+ <!-- Test name conflict resolution. -->
+
+ <simpleType name="size_type">
+ <list itemType="int"/>
+ </simpleType>
+
+ <simpleType name="I">
+ <list itemType="int"/>
+ </simpleType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/buildfile b/xsd-tests/cxx/tree/name-clash/inheritance/buildfile
new file mode 100644
index 0000000..530c42f
--- /dev/null
+++ b/xsd-tests/cxx/tree/name-clash/inheritance/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/tree/name-clash/inheritance/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-ostream \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx b/xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx
new file mode 100644
index 0000000..634c56a
--- /dev/null
+++ b/xsd-tests/cxx/tree/name-clash/inheritance/driver.cxx
@@ -0,0 +1,35 @@
+// file : cxx/tree/name-clash/inheritance/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test for name clashes across inheritance hierarchy.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<derived> r (root (argv[1]));
+
+ cout << *r << endl;
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/output b/xsd-tests/cxx/tree/name-clash/inheritance/output
new file mode 100644
index 0000000..54565bb
--- /dev/null
+++ b/xsd-tests/cxx/tree/name-clash/inheritance/output
@@ -0,0 +1,3 @@
+
+e: e
+e: e1
diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/test.xml b/xsd-tests/cxx/tree/name-clash/inheritance/test.xml
new file mode 100644
index 0000000..8c17101
--- /dev/null
+++ b/xsd-tests/cxx/tree/name-clash/inheritance/test.xml
@@ -0,0 +1,8 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <e>e</e>
+ <e>e1</e>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/name-clash/inheritance/test.xsd b/xsd-tests/cxx/tree/name-clash/inheritance/test.xsd
new file mode 100644
index 0000000..b83d7df
--- /dev/null
+++ b/xsd-tests/cxx/tree/name-clash/inheritance/test.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- same member name in base and derived -->
+
+ <complexType name="base">
+ <sequence>
+ <element name="e" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="derived">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="e" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="root" type="t:derived"/>
+
+ <!-- same c-tor argument names (compilation only) -->
+
+ <complexType name="ctor-args">
+ <simpleContent>
+ <extension base="string">
+ <attribute name="string" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+
+ <!-- same c-tor argument names (compilation only) -->
+
+ <complexType name="ctor-args-base">
+ <simpleContent>
+ <extension base="string">
+ <attribute name="ctor-args-derived" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <complexType name="ctor-args-derived">
+ <simpleContent>
+ <extension base="t:ctor-args-base">
+ <attribute name="foo" type="string" use="required"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/naming/camel/buildfile b/xsd-tests/cxx/tree/naming/camel/buildfile
new file mode 100644
index 0000000..8a8410c
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/camel/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/naming/camel/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --type-naming ucc \
+ --function-naming lcc \
+ --generate-ostream \
+ --generate-comparison \
+ --generate-wildcard \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/naming/camel/driver.cxx b/xsd-tests/cxx/tree/naming/camel/driver.cxx
new file mode 100644
index 0000000..600b3ff
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/camel/driver.cxx
@@ -0,0 +1,154 @@
+// file : cxx/tree/naming/camel/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test camel case (upper for types, lower for functions) naming style.
+//
+
+#include <sstream>
+#include <iostream>
+
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ xercesc::XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ // Enum 'value' type.
+ //
+ {
+ Gender::Value v;
+ v = Gender::female;
+ XSD_UNUSED (v);
+ }
+
+ // Anonymous type.
+ //
+ {
+ Foo f ("a", "b");
+
+ if (f.a () != "a" || f.b () != "b")
+ return 1;
+ }
+
+ // Type name and accessors/modifiers.
+ //
+ {
+ Type t ("bar");
+
+ // foo
+ //
+ {
+ Type::FooType* p = 0;
+ XSD_UNUSED (p);
+
+ Type::FooOptional o;
+
+ if (t.foo ().present ())
+ return 1;
+
+ t.foo (o);
+ }
+
+ // bar
+ //
+ {
+ Type::BarType* p = 0;
+ XSD_UNUSED (p);
+
+ if (t.bar () != "bar")
+ return 1;
+
+ t.bar ("barbar");
+ }
+
+ // baz
+ //
+ {
+ Type::BazType* p = 0;
+ XSD_UNUSED (p);
+
+ Type::BazSequence s;
+ Type::BazIterator i (s.begin ());
+ Type::BazConstIterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.baz () != s)
+ return 1;
+
+ t.baz (s);
+ }
+
+ // any
+ //
+ {
+ Type::AnySequence s (t.domDocument ());
+ Type::AnyIterator i (s.begin ());
+ Type::AnyConstIterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.any () != s)
+ return 1;
+
+ t.any (s);
+ }
+
+ // foo
+ //
+ {
+ Type::FoxType x = Type::foxDefaultValue ();
+
+ if (t.fox () != x)
+ return 1;
+
+ t.fox ("fox");
+ }
+
+ // any_attribute
+ //
+ {
+ Type::AnyAttributeSet s (t.domDocument ());
+ Type::AnyAttributeIterator i (s.begin ());
+ Type::AnyAttributeConstIterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.anyAttribute () != s)
+ return 1;
+
+ t.anyAttribute (s);
+ }
+ }
+
+ // Parsing/serialization functions.
+ //
+ {
+ istringstream is ("<t:Root xmlns:t='test'>foo</t:Root>");
+ root (is, xml_schema::Flags::dont_validate);
+ }
+
+ {
+ ostringstream os;
+ xml_schema::NamespaceInfomap m;
+ m["t"].name = "test";
+
+ root (os, "foo", m);
+ }
+ }
+ catch (xml_schema::Exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ xercesc::XMLPlatformUtils::Terminate ();
+}
diff --git a/xsd-tests/cxx/tree/naming/camel/test.xsd b/xsd-tests/cxx/tree/naming/camel/test.xsd
new file mode 100644
index 0000000..7d0a745
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/camel/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="gender">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="foo" minOccurs="0">
+ <complexType>
+ <sequence>
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="Bar" type="string"/>
+ <element name="Baz" type="string" maxOccurs="unbounded"/>
+ <any namespace="other" processContents="skip" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Fox" type="string" default="hello"/>
+ <anyAttribute namespace="##other" processContents="skip"/>
+ </complexType>
+
+ <element name="Root" type="string"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/naming/java/buildfile b/xsd-tests/cxx/tree/naming/java/buildfile
new file mode 100644
index 0000000..5d4b447
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/java/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/naming/java/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --type-naming java \
+ --function-naming java \
+ --generate-ostream \
+ --generate-comparison \
+ --generate-wildcard \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/naming/java/driver.cxx b/xsd-tests/cxx/tree/naming/java/driver.cxx
new file mode 100644
index 0000000..b47ff74
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/java/driver.cxx
@@ -0,0 +1,153 @@
+// file : cxx/tree/naming/java/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test Java naming style.
+//
+
+#include <sstream>
+#include <iostream>
+
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ xercesc::XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ // Enum 'value' type.
+ //
+ {
+ Gender::Value v;
+ v = Gender::female;
+ XSD_UNUSED (v);
+ }
+
+ // Anonymous type.
+ //
+ {
+ Foo f ("a", "b");
+
+ if (f.getA () != "a" || f.getB () != "b")
+ return 1;
+ }
+
+ // Type name and accessors/modifiers.
+ //
+ {
+ Type t ("bar");
+
+ // foo
+ //
+ {
+ Type::FooType* p = 0;
+ XSD_UNUSED (p);
+ Type::FooOptional o;
+
+ if (t.getFoo ().present ())
+ return 1;
+
+ t.setFoo (o);
+ }
+
+ // bar
+ //
+ {
+ Type::BarType* p = 0;
+ XSD_UNUSED (p);
+
+ if (t.getBar () != "bar")
+ return 1;
+
+ t.setBar ("barbar");
+ }
+
+ // baz
+ //
+ {
+ Type::BazType* p = 0;
+ XSD_UNUSED (p);
+
+ Type::BazSequence s;
+ Type::BazIterator i (s.begin ());
+ Type::BazConstIterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.getBaz () != s)
+ return 1;
+
+ t.setBaz (s);
+ }
+
+ // any
+ //
+ {
+ Type::AnySequence s (t.getDomDocument ());
+ Type::AnyIterator i (s.begin ());
+ Type::AnyConstIterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.getAny () != s)
+ return 1;
+
+ t.setAny (s);
+ }
+
+ // foo
+ //
+ {
+ Type::FoxType x = Type::getFoxDefaultValue ();
+
+ if (t.getFox () != x)
+ return 1;
+
+ t.setFox ("fox");
+ }
+
+ // any_attribute
+ //
+ {
+ Type::AnyAttributeSet s (t.getDomDocument ());
+ Type::AnyAttributeIterator i (s.begin ());
+ Type::AnyAttributeConstIterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.getAnyAttribute () != s)
+ return 1;
+
+ t.setAnyAttribute (s);
+ }
+ }
+
+ // Parsing/serialization functions.
+ //
+ {
+ istringstream is ("<t:root xmlns:t='test'>foo</t:root>");
+ parseRoot (is, xml_schema::Flags::dont_validate);
+ }
+
+ {
+ ostringstream os;
+ xml_schema::NamespaceInfomap m;
+ m["t"].name = "test";
+
+ serializeRoot (os, "foo", m);
+ }
+ }
+ catch (xml_schema::Exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ xercesc::XMLPlatformUtils::Terminate ();
+}
diff --git a/xsd-tests/cxx/tree/naming/java/test.xsd b/xsd-tests/cxx/tree/naming/java/test.xsd
new file mode 100644
index 0000000..f525534
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/java/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="gender">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="foo" minOccurs="0">
+ <complexType>
+ <sequence>
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="bar" type="string"/>
+ <element name="Baz" type="string" maxOccurs="unbounded"/>
+ <any namespace="other" processContents="skip" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Fox" type="string" default="hello"/>
+ <anyAttribute namespace="##other" processContents="skip"/>
+ </complexType>
+
+ <element name="root" type="string"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/naming/knr/buildfile b/xsd-tests/cxx/tree/naming/knr/buildfile
new file mode 100644
index 0000000..c4c2287
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/knr/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/naming/knr/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --type-naming knr \
+ --function-naming knr \
+ --generate-ostream \
+ --generate-comparison \
+ --generate-wildcard \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/naming/knr/driver.cxx b/xsd-tests/cxx/tree/naming/knr/driver.cxx
new file mode 100644
index 0000000..8c75dd9
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/knr/driver.cxx
@@ -0,0 +1,154 @@
+// file : cxx/tree/naming/knr/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test K&R naming style.
+//
+
+#include <sstream>
+#include <iostream>
+
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ xercesc::XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ // Enum 'value' type.
+ //
+ {
+ gender::value v;
+ v = gender::female;
+ XSD_UNUSED (v);
+ }
+
+ // Anonymous type.
+ //
+ {
+ foo f ("a", "b");
+
+ if (f.a () != "a" || f.b () != "b")
+ return 1;
+ }
+
+ // Type name and accessors/modifiers.
+ //
+ {
+ type t ("bar");
+
+ // foo
+ //
+ {
+ type::foo_type* p = 0;
+ XSD_UNUSED (p);
+
+ type::foo_optional o;
+
+ if (t.foo ().present ())
+ return 1;
+
+ t.foo (o);
+ }
+
+ // bar
+ //
+ {
+ type::bar_type* p = 0;
+ XSD_UNUSED (p);
+
+ if (t.bar () != "bar")
+ return 1;
+
+ t.bar ("barbar");
+ }
+
+ // baz
+ //
+ {
+ type::baz_type* p = 0;
+ XSD_UNUSED (p);
+
+ type::baz_sequence s;
+ type::baz_iterator i (s.begin ());
+ type::baz_const_iterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.baz () != s)
+ return 1;
+
+ t.baz (s);
+ }
+
+ // any
+ //
+ {
+ type::any_sequence s (t.dom_document ());
+ type::any_iterator i (s.begin ());
+ type::any_const_iterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.any () != s)
+ return 1;
+
+ t.any (s);
+ }
+
+ // foo
+ //
+ {
+ type::fox_type x = type::fox_default_value ();
+
+ if (t.fox () != x)
+ return 1;
+
+ t.fox ("fox");
+ }
+
+ // any_attribute
+ //
+ {
+ type::any_attribute_set s (t.dom_document ());
+ type::any_attribute_iterator i (s.begin ());
+ type::any_attribute_const_iterator ci (s.begin ());
+ XSD_UNUSED (i);
+ XSD_UNUSED (ci);
+
+ if (t.any_attribute () != s)
+ return 1;
+
+ t.any_attribute (s);
+ }
+ }
+
+ // Parsing/serialization functions.
+ //
+ {
+ istringstream is ("<t:root xmlns:t='test'>foo</t:root>");
+ root (is, xml_schema::flags::dont_validate);
+ }
+
+ {
+ ostringstream os;
+ xml_schema::namespace_infomap m;
+ m["t"].name = "test";
+
+ root (os, "foo", m);
+ }
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ xercesc::XMLPlatformUtils::Terminate ();
+}
diff --git a/xsd-tests/cxx/tree/naming/knr/test.xsd b/xsd-tests/cxx/tree/naming/knr/test.xsd
new file mode 100644
index 0000000..4361544
--- /dev/null
+++ b/xsd-tests/cxx/tree/naming/knr/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="gender">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="foo" minOccurs="0">
+ <complexType>
+ <sequence>
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="bar" type="string"/>
+ <element name="baz" type="string" maxOccurs="unbounded"/>
+ <any namespace="other" processContents="skip" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="fox" type="string" default="hello"/>
+ <anyAttribute namespace="##other" processContents="skip"/>
+ </complexType>
+
+ <element name="root" type="string"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/order/buildfile b/xsd-tests/cxx/tree/order/buildfile
new file mode 100644
index 0000000..91c3cb7
--- /dev/null
+++ b/xsd-tests/cxx/tree/order/buildfile
@@ -0,0 +1,37 @@
+# file : cxx/tree/order/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-wildcard \
+ --generate-comparison \
+ --ordered-type t1_base \
+ --ordered-type t1_derived \
+ --ordered-type t2_base \
+ --ordered-type t2_derived \
+ --ordered-type t3_type \
+ --ordered-type t4_base \
+ --ordered-type t4_derived \
+ --ordered-type t5_base \
+ --ordered-type t5_derived \
+ --ordered-type t6_base \
+ --ordered-type t6_derived \
+ --ordered-type t7_type \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/order/driver.cxx b/xsd-tests/cxx/tree/order/driver.cxx
new file mode 100644
index 0000000..f1902ba
--- /dev/null
+++ b/xsd-tests/cxx/tree/order/driver.cxx
@@ -0,0 +1,64 @@
+// file : cxx/tree/order/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test ordered type support.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+#include <iostream>
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+using namespace xercesc;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ XSD_AUTO_PTR<root> r (root_ (argv[1], xml_schema::flags::dont_initialize));
+
+ root c (*r);
+ assert (c == *r);
+
+ for (root::t1_const_iterator j (r->t1 ().begin ());
+ j != r->t1 ().end (); ++j)
+ {
+ const t1_derived& d (*j);
+
+ for (t1_derived::content_order_const_iterator i (
+ d.content_order ().begin ()); i != d.content_order ().end (); ++i)
+ {
+ cout << i->id << ' ' << i->index << endl;
+ }
+ }
+
+ xml_schema::namespace_infomap map;
+
+ map["t"].name = "test";
+ map["t1"].name = "test1";
+
+ root_ (cout, *r, map, "UTF-8", xml_schema::flags::dont_initialize);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Terminate ();
+}
diff --git a/xsd-tests/cxx/tree/order/output b/xsd-tests/cxx/tree/order/output
new file mode 100644
index 0000000..73442fe
--- /dev/null
+++ b/xsd-tests/cxx/tree/order/output
@@ -0,0 +1,92 @@
+2 0
+1 0
+1 1
+2 1
+3 0
+4 0
+3 1
+4 1
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<t:root xmlns:t="test" xmlns:t1="test1">
+ <t1>
+ <b>b1</b>
+ <a>a1</a>
+ <a>a2</a>
+ <b>b2</b>
+ <c>c1</c>
+ <d>d1</d>
+ <t1:e>e1</t1:e>
+ <d>d2</d>
+ <t1:f>f1</t1:f>
+ </t1>
+ <t2>
+ <b>b1</b>
+ <a>a1</a>
+ <b>b2</b>
+ <a>a2</a>
+ </t2>
+ <t3>
+ <a>a1</a>
+ <b>b1</b>
+ <c>c1</c>
+ <c>c2</c>
+ </t3>
+ <t3>
+ <a>a1</a>
+ <c>c1</c>
+ </t3>
+ <t4>
+ t1
+
+ <b>b1</b>
+ t2
+
+ <a>a1</a>
+ t3
+
+ <b>b2</b>
+ t4
+
+ <a>a2</a>
+ t5
+
+ <t1:d>d1</t1:d>
+ t6
+
+ <c>c1</c>
+ t7
+
+ </t4>
+ <t5a>
+ t5a
+ </t5a>
+ <t5b>
+ t1
+
+ <b>b1</b>
+ t2
+
+ <a>a1</a>
+ t3
+
+ <a>a2</a>
+ t4
+
+ <b>b2</b>
+ t5
+
+ </t5b>
+ <t6>
+ t6
+ </t6>
+ <t7>
+ t1
+
+ <t1:a>a1</t1:a>
+ t2
+
+ <t1:b>b1</t1:b>
+ t3
+
+ </t7>
+</t:root>
diff --git a/xsd-tests/cxx/tree/order/test.xml b/xsd-tests/cxx/tree/order/test.xml
new file mode 100644
index 0000000..cd82936
--- /dev/null
+++ b/xsd-tests/cxx/tree/order/test.xml
@@ -0,0 +1,71 @@
+<t:root xmlns:t="test"
+ xmlns:t1="test1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+ <t1>
+ <b>b1</b>
+ <a>a1</a>
+ <a>a2</a>
+ <b>b2</b>
+ <c>c1</c>
+ <d>d1</d>
+ <t1:e>e1</t1:e>
+ <d>d2</d>
+ <t1:f>f1</t1:f>
+ </t1>
+ <t2>
+ <b>b1</b>
+ <a>a1</a>
+ <b>b2</b>
+ <a>a2</a>
+ </t2>
+ <t3>
+ <a>a1</a>
+ <b>b1</b>
+ <c>c1</c>
+ <c>c2</c>
+ </t3>
+ <t3>
+ <a>a1</a>
+ <c>c1</c>
+ </t3>
+ <t4>
+ t1
+ <b>b1</b>
+ t2
+ <a>a1</a>
+ t3
+ <b>b2</b>
+ t4
+ <a>a2</a>
+ t5
+ <t1:d>d1</t1:d>
+ t6
+ <c>c1</c>
+ t7
+ </t4>
+ <t5a>
+ t5a
+ </t5a>
+ <t5b>
+ t1
+ <b>b1</b>
+ t2
+ <a>a1</a>
+ t3
+ <a>a2</a>
+ t4
+ <b>b2</b>
+ t5
+ </t5b>
+ <t6>
+ t6
+ </t6>
+ <t7>
+ t1
+ <t1:a>a1</t1:a>
+ t2
+ <t1:b>b1</t1:b>
+ t3
+ </t7>
+</t:root>
diff --git a/xsd-tests/cxx/tree/order/test.xsd b/xsd-tests/cxx/tree/order/test.xsd
new file mode 100644
index 0000000..c30c027
--- /dev/null
+++ b/xsd-tests/cxx/tree/order/test.xsd
@@ -0,0 +1,130 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Test 1: general, with non-ordered intermediate. -->
+
+ <complexType name="t1_base">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </choice>
+ </complexType>
+
+ <complexType name="t1_interm">
+ <complexContent>
+ <extension base="t:t1_base">
+ <sequence>
+ <element name="c" type="string" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="t1_derived">
+ <complexContent>
+ <extension base="t:t1_interm">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="d" type="string"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- Test 2: empty base. -->
+
+ <complexType name="t2_base"/>
+
+ <complexType name="t2_derived">
+ <complexContent>
+ <extension base="t:t2_base">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </choice>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- Test 3: element cardinalities. -->
+
+ <complexType name="t3_type">
+ <sequence>
+ <element name="a" type="string"/>
+ <element name="b" type="string" minOccurs="0"/>
+ <element name="c" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+
+ <!-- Test 4: mixed content, general. -->
+
+ <complexType name="t4_base" mixed="true">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </choice>
+ </complexType>
+
+ <complexType name="t4_derived">
+ <complexContent mixed="true">
+ <extension base="t:t4_base">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="c" type="string"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- Test 5: mixed content, empty base. -->
+
+ <complexType name="t5_base" mixed="true"/>
+
+ <complexType name="t5_derived">
+ <complexContent mixed="true">
+ <extension base="t:t5_base">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="a" type="string"/>
+ <element name="b" type="string"/>
+ </choice>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- Test 6: mixed content, empty base and derived. -->
+
+ <complexType name="t6_base" mixed="true"/>
+
+ <complexType name="t6_derived">
+ <complexContent mixed="true">
+ <extension base="t:t6_base"/>
+ </complexContent>
+ </complexType>
+
+ <!-- Test 7: mixed content wildcard only. -->
+
+ <complexType name="t7_type" mixed="true">
+ <sequence>
+ <any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <!-- Root -->
+
+ <complexType name="root">
+ <sequence>
+ <element name="t1" type="t:t1_derived" maxOccurs="unbounded"/>
+ <element name="t2" type="t:t2_derived" maxOccurs="unbounded"/>
+ <element name="t3" type="t:t3_type" maxOccurs="unbounded"/>
+ <element name="t4" type="t:t4_derived" maxOccurs="unbounded"/>
+ <element name="t5a" type="t:t5_base" maxOccurs="unbounded"/>
+ <element name="t5b" type="t:t5_derived" maxOccurs="unbounded"/>
+ <element name="t6" type="t:t6_derived" maxOccurs="unbounded"/>
+ <element name="t7" type="t:t7_type" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:root"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/buildfile b/xsd-tests/cxx/tree/polymorphism/comparison/buildfile
new file mode 100644
index 0000000..0bb0b77
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/comparison/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/polymorphism/comparison/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-polymorphic \
+ --polymorphic-type base \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx b/xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx
new file mode 100644
index 0000000..cadb225
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/comparison/driver.cxx
@@ -0,0 +1,85 @@
+// file : cxx/tree/polymorphism/comparison/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test comparison of polymorphic object models.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <sstream>
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ // Equals.
+ //
+ {
+ derived1 d ("a", 1);
+ d.b ("b");
+ type r1 (d);
+
+ assert (*r == r1);
+ }
+
+ // Values are not equal.
+ //
+ {
+ derived1 d ("a", 1);
+ d.b ("c");
+ type r1 (d);
+
+ assert (*r != r1);
+ }
+
+ // Values are not equal.
+ //
+ {
+ derived1 d ("a", 2);
+ d.b ("b");
+ type r1 (d);
+
+ assert (*r != r1);
+ }
+
+ // Different types.
+ //
+ {
+ derived2 d ("a", 1);
+ d.c ().push_back ("c");
+ type r1 (d);
+
+ assert (*r != r1);
+ }
+
+ xml_schema::namespace_infomap map;
+
+ map["t"].name = "test";
+
+ stringstream s;
+ root (s, *r, map);
+
+ XSD_AUTO_PTR<type> c (root (s, xml_schema::flags::dont_validate));
+
+ assert (*r == *c);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/test.xml b/xsd-tests/cxx/tree/polymorphism/comparison/test.xml
new file mode 100644
index 0000000..0b8c125
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/comparison/test.xml
@@ -0,0 +1,7 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <base xsi:type="t:derived1"><a>a</a><fund>1</fund><b>b</b></base>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/polymorphism/comparison/test.xsd b/xsd-tests/cxx/tree/polymorphism/comparison/test.xsd
new file mode 100644
index 0000000..364d1b3
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/comparison/test.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="base" abstract="true">
+ <sequence>
+ <element name="a" type="string"/>
+ <element name="fund" type="int"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="derived1">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="derived2">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="c" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="base" type="t:base"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/buildfile b/xsd-tests/cxx/tree/polymorphism/ostream/buildfile
new file mode 100644
index 0000000..2237c73
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/ostream/buildfile
@@ -0,0 +1,26 @@
+# file : cxx/tree/polymorphism/ostream/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-polymorphic \
+ --polymorphic-type-all \
+ --root-element root \
+ --generate-ostream \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx b/xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx
new file mode 100644
index 0000000..b030be9
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/ostream/driver.cxx
@@ -0,0 +1,34 @@
+// file : cxx/tree/polymorphism/ostream/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test printing of polymorphic object models.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+ cout << *r << endl;
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/output b/xsd-tests/cxx/tree/polymorphism/ostream/output
new file mode 100644
index 0000000..e7fbd68
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/ostream/output
@@ -0,0 +1,18 @@
+
+base:
+a: a
+fund: 1
+base:
+a: a
+fund: 1
+b: b
+base:
+a: a
+fund: 1
+c: c1
+c: c2
+base:
+a: a
+fund: 1
+d: d1
+d: d2
diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/test.xml b/xsd-tests/cxx/tree/polymorphism/ostream/test.xml
new file mode 100644
index 0000000..5409d2a
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/ostream/test.xml
@@ -0,0 +1,10 @@
+<root xmlns="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <base><a>a</a><fund>1</fund></base>
+ <base xsi:type="derived1"><a>a</a><fund>1</fund><b>b</b></base>
+ <base xsi:type="derived2"><a>a</a><fund>1</fund><c>c1</c><c>c2</c></base>
+ <derived3><a>a</a><fund>1</fund><d>d1</d><d>d2</d></derived3>
+
+</root>
diff --git a/xsd-tests/cxx/tree/polymorphism/ostream/test.xsd b/xsd-tests/cxx/tree/polymorphism/ostream/test.xsd
new file mode 100644
index 0000000..688cd5a
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/ostream/test.xsd
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test"
+ targetNamespace="test" elementFormDefault="qualified">
+
+ <complexType name="abst_base" abstract="1">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="base">
+ <complexContent>
+ <extension base="t:abst_base">
+ <sequence>
+ <element name="fund" type="int"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <element name="base" type="t:base"/>
+
+ <complexType name="derived1">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="b" type="string" minOccurs="0"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="derived2">
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="c" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="derived3" substitutionGroup="t:base">
+ <complexType>
+ <complexContent>
+ <extension base="t:base">
+ <sequence>
+ <element name="d" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <complexType name="type">
+ <sequence>
+ <element ref="t:base" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/buildfile b/xsd-tests/cxx/tree/polymorphism/same-type/buildfile
new file mode 100644
index 0000000..46720d6
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/same-type/buildfile
@@ -0,0 +1,25 @@
+# file : cxx/tree/polymorphism/same-type/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-polymorphic \
+ --root-element root \
+ --generate-ostream \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx b/xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx
new file mode 100644
index 0000000..94f82f5
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/same-type/driver.cxx
@@ -0,0 +1,35 @@
+// file : cxx/tree/polymorphism/same-type/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test substitution group and xsi:type that don't change the type.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ cout << *r << endl;
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/output b/xsd-tests/cxx/tree/polymorphism/same-type/output
new file mode 100644
index 0000000..04b5cbf
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/same-type/output
@@ -0,0 +1,9 @@
+
+base:
+a: a1
+base:
+a: a2
+base:
+a: a3
+base:
+a: a4
diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/test.xml b/xsd-tests/cxx/tree/polymorphism/same-type/test.xml
new file mode 100644
index 0000000..f8b6d1e
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/same-type/test.xml
@@ -0,0 +1,10 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <t:base><a>a1</a></t:base>
+ <t:derived><a>a2</a></t:derived>
+ <t:base xsi:type="t:base"><a>a3</a></t:base>
+ <t:derived xsi:type="t:base"><a>a4</a></t:derived>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/polymorphism/same-type/test.xsd b/xsd-tests/cxx/tree/polymorphism/same-type/test.xsd
new file mode 100644
index 0000000..a4157d3
--- /dev/null
+++ b/xsd-tests/cxx/tree/polymorphism/same-type/test.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="base">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="base" type="t:base"/>
+ <element name="derived" type="t:base" substitutionGroup="t:base"/>
+
+ <complexType name="type">
+ <sequence>
+ <element ref="t:base" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/prefix/.gitignore b/xsd-tests/cxx/tree/prefix/.gitignore
new file mode 100644
index 0000000..2457930
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/.gitignore
@@ -0,0 +1,2 @@
+bar.?xx
+foo.?xx
diff --git a/xsd-tests/cxx/tree/prefix/bar.xsd b/xsd-tests/cxx/tree/prefix/bar.xsd
new file mode 100644
index 0000000..4e20902
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/bar.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:f="foo"
+ xmlns:b="bar"
+ targetNamespace="bar"
+ attributeFormDefault="qualified">
+
+ <import namespace="foo" schemaLocation="foo.xsd"/>
+
+ <attribute name="abar" type="int"/>
+
+ <complexType name="derived1">
+ <complexContent>
+ <extension base="f:base">
+ <sequence>
+ <element name="y" type="int"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="derived2">
+ <complexContent>
+ <extension base="f:base">
+ <sequence>
+ <element name="z" type="int"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="derived" type="b:derived1" substitutionGroup="f:base"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/prefix/buildfile b/xsd-tests/cxx/tree/prefix/buildfile
new file mode 100644
index 0000000..7ac81de
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/buildfile
@@ -0,0 +1,31 @@
+# file : cxx/tree/prefix/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = foo bar test
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx ixx cxx}{$fs} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+for f: $fs
+{
+ <{hxx ixx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-polymorphic \
+ --polymorphic-type 'foo#base' \
+ --root-element root \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/prefix/driver.cxx b/xsd-tests/cxx/tree/prefix/driver.cxx
new file mode 100644
index 0000000..bd2e46d
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/driver.cxx
@@ -0,0 +1,34 @@
+// file : cxx/tree/prefix/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test automatic prefix assignment.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+ root (std::cout, *r);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/prefix/foo.xsd b/xsd-tests/cxx/tree/prefix/foo.xsd
new file mode 100644
index 0000000..97a35cf
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/foo.xsd
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:f="foo"
+ targetNamespace="foo">
+
+ <element name="efoo" type="int"/>
+
+ <complexType name="base">
+ <sequence>
+ <element name="x" type="int"/>
+ </sequence>
+ </complexType>
+
+ <element name="base" type="f:base"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/prefix/output b/xsd-tests/cxx/tree/prefix/output
new file mode 100644
index 0000000..9801a23
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/output
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<p1:root xmlns:p1="test">
+ <a xmlns:p3="bar" p3:abar="456" xmlns:p2="foo">
+ <p2:efoo>123</p2:efoo>
+ </a>
+ <b xmlns:p2="bar">
+ <p2:derived>
+ <x>1</x>
+ <y>2</y>
+ </p2:derived>
+ </b>
+ <c xmlns:p2="foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <p2:base xmlns:p3="bar" xsi:type="p3:derived2">
+ <x>1</x>
+ <z>2</z>
+ </p2:base>
+ </c>
+</p1:root>
diff --git a/xsd-tests/cxx/tree/prefix/test.xml b/xsd-tests/cxx/tree/prefix/test.xml
new file mode 100644
index 0000000..b6d0dd6
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/test.xml
@@ -0,0 +1,19 @@
+<t:root xmlns:t="test"
+ xmlns:f="foo"
+ xmlns:b="bar"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a b:abar="456">
+ <f:efoo>123</f:efoo>
+ </a>
+
+ <b>
+ <b:derived><x>1</x><y>2</y></b:derived>
+ </b>
+
+ <c>
+ <f:base xsi:type="b:derived2"><x>1</x><z>2</z></f:base>
+ </c>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/prefix/test.xsd b/xsd-tests/cxx/tree/prefix/test.xsd
new file mode 100644
index 0000000..421fdc0
--- /dev/null
+++ b/xsd-tests/cxx/tree/prefix/test.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:f="foo"
+ xmlns:b="bar"
+ xmlns:t="test"
+ targetNamespace="test">
+
+ <import namespace="foo" schemaLocation="foo.xsd"/>
+ <import namespace="bar" schemaLocation="bar.xsd"/>
+
+ <complexType name="a">
+ <sequence>
+ <element ref="f:efoo"/>
+ </sequence>
+ <attribute ref="b:abar"/>
+ </complexType>
+
+ <complexType name="b">
+ <sequence>
+ <element ref="f:base"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="c">
+ <sequence>
+ <element ref="f:base"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="t:a"/>
+ <element name="b" type="t:b"/>
+ <element name="c" type="t:c"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/test-template/buildfile b/xsd-tests/cxx/tree/test-template/buildfile
new file mode 100644
index 0000000..b50e6c3
--- /dev/null
+++ b/xsd-tests/cxx/tree/test-template/buildfile
@@ -0,0 +1,23 @@
+# file : cxx/tree/test-template/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-ostream \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/test-template/driver.cxx b/xsd-tests/cxx/tree/test-template/driver.cxx
new file mode 100644
index 0000000..5257279
--- /dev/null
+++ b/xsd-tests/cxx/tree/test-template/driver.cxx
@@ -0,0 +1,35 @@
+// file : cxx/tree/test-template/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Insert test description here.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ try
+ {
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+
+ cout << *r << endl;
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+}
diff --git a/xsd-tests/cxx/tree/test-template/output b/xsd-tests/cxx/tree/test-template/output
new file mode 100644
index 0000000..2a50681
--- /dev/null
+++ b/xsd-tests/cxx/tree/test-template/output
@@ -0,0 +1,2 @@
+
+a: a
diff --git a/xsd-tests/cxx/tree/test-template/test.xml b/xsd-tests/cxx/tree/test-template/test.xml
new file mode 100644
index 0000000..624a80c
--- /dev/null
+++ b/xsd-tests/cxx/tree/test-template/test.xml
@@ -0,0 +1,7 @@
+<t:root xmlns:t="test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd">
+
+ <a>a</a>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/test-template/test.xsd b/xsd-tests/cxx/tree/test-template/test.xsd
new file mode 100644
index 0000000..07bebc7
--- /dev/null
+++ b/xsd-tests/cxx/tree/test-template/test.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/types-only/buildfile b/xsd-tests/cxx/tree/types-only/buildfile
new file mode 100644
index 0000000..fa02277
--- /dev/null
+++ b/xsd-tests/cxx/tree/types-only/buildfile
@@ -0,0 +1,20 @@
+# file : cxx/tree/types-only/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --suppress-parsing \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/types-only/driver.cxx b/xsd-tests/cxx/tree/types-only/driver.cxx
new file mode 100644
index 0000000..730b807
--- /dev/null
+++ b/xsd-tests/cxx/tree/types-only/driver.cxx
@@ -0,0 +1,30 @@
+// file : cxx/tree/types-only/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test that code generated without parsing and serialization functions
+// still compiles.
+//
+
+#include <iostream>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ color_enum red (color_enum::red);
+ red_blue_enum blue (red_blue_enum::blue);
+
+ long_string_union num ("123");
+
+ string_list list;
+ list.push_back ("Hello");
+ list.push_back ("World");
+
+ complex_type t ("Hello, World!", "foo", color_enum::red);
+
+ anon a ("Hello, World!");
+}
diff --git a/xsd-tests/cxx/tree/types-only/test.xsd b/xsd-tests/cxx/tree/types-only/test.xsd
new file mode 100644
index 0000000..9f02240
--- /dev/null
+++ b/xsd-tests/cxx/tree/types-only/test.xsd
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="color-enum">
+ <restriction base="token">
+ <enumeration value="red"/>
+ <enumeration value="green"/>
+ <enumeration value="blue"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="red-blue-enum">
+ <restriction base="t:color-enum">
+ <enumeration value="red"/>
+ <enumeration value="blue"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="long-string-union">
+ <union memberTypes="long string"/>
+ </simpleType>
+
+ <simpleType name="string-list">
+ <list itemType="string"/>
+ </simpleType>
+
+ <complexType name="complex-type">
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ <attribute name="text" type="string" use="required"/>
+ <attribute name="color" type="t:color-enum" use="required"/>
+ <attribute name="ftext" type="string" fixed="foo"/>
+ <attribute name="dcolor" type="t:color-enum" default="red"/>
+ </complexType>
+
+ <!-- Test that we do not perform type/element name conflict resolution
+ as well as print any warnings. -->
+ <element name="type" type="string"/>
+
+ <!-- Test that we generate anonymous type for global element. -->
+ <element name="anon">
+ <complexType>
+ <sequence>
+ <element name="a" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="root" type="t:complex-type"/>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/union/ctor/buildfile b/xsd-tests/cxx/tree/union/ctor/buildfile
new file mode 100644
index 0000000..6715cb6
--- /dev/null
+++ b/xsd-tests/cxx/tree/union/ctor/buildfile
@@ -0,0 +1,22 @@
+# file : cxx/tree/union/ctor/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --generate-doxygen \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/union/ctor/driver.cxx b/xsd-tests/cxx/tree/union/ctor/driver.cxx
new file mode 100644
index 0000000..246eea8
--- /dev/null
+++ b/xsd-tests/cxx/tree/union/ctor/driver.cxx
@@ -0,0 +1,30 @@
+// file : cxx/tree/union/ctor/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test union constructors.
+//
+#include <string>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+
+int
+main ()
+{
+ // Test ctor(const std::string&)
+ //
+ {
+ string const s ("123");
+ int_string_union u (s);
+ type t (s);
+ }
+
+ // Test ctor(const char*).
+ //
+ {
+ int_string_union u ("123");
+ type t ("123");
+ }
+}
diff --git a/xsd-tests/cxx/tree/union/ctor/test.xsd b/xsd-tests/cxx/tree/union/ctor/test.xsd
new file mode 100644
index 0000000..9601093
--- /dev/null
+++ b/xsd-tests/cxx/tree/union/ctor/test.xsd
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="int-string-union">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <complexType name="type">
+ <sequence>
+ <element name="a" type="t:int-string-union"/>
+ </sequence>
+ </complexType>
+
+</schema>
diff --git a/xsd-tests/cxx/tree/wildcard/buildfile b/xsd-tests/cxx/tree/wildcard/buildfile
new file mode 100644
index 0000000..67edcdc
--- /dev/null
+++ b/xsd-tests/cxx/tree/wildcard/buildfile
@@ -0,0 +1,27 @@
+# file : cxx/tree/wildcard/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs
+
+exe{driver}: xml{test}: test.input = true
+exe{driver}: file{output}: test.stdout = true
+
+<{hxx ixx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --generate-inline \
+ --generate-serialization \
+ --generate-wildcard \
+ --generate-default-ctor \
+ --generate-from-base-ctor \
+ --generate-comparison \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/cxx/tree/wildcard/driver.cxx b/xsd-tests/cxx/tree/wildcard/driver.cxx
new file mode 100644
index 0000000..e3040c7
--- /dev/null
+++ b/xsd-tests/cxx/tree/wildcard/driver.cxx
@@ -0,0 +1,203 @@
+// file : cxx/tree/wildcard/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test wildcard (any & anyAttribute) mapping.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <sstream>
+#include <iostream>
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx" // Get XSD_CXX11 defined.
+
+#include <xsd/cxx/xml/string.hxx>
+
+using namespace std;
+using namespace test;
+using namespace xercesc;
+
+namespace xml = xsd::cxx::xml;
+
+void
+print (type& t)
+{
+ if (t.att ())
+ cout << *t.att () << endl;
+
+ type::any_attribute_set& as (t.any_attribute ());
+
+ for (type::any_attribute_iterator i (as.begin ()); i != as.end (); ++i)
+ {
+ cout << xml::transcode<char> (i->getTextContent ()) << endl;
+ }
+
+ cout << xml::transcode<char> (t.any ().getTextContent ()) << endl
+ << t.foo () << endl;
+
+ if (t.any1 ())
+ cout << xml::transcode<char> (t.any1 ()->getTextContent ()) << endl;
+
+ cout << t.bar () << endl;
+
+ type::any2_sequence& es (t.any2 ());
+
+ for (type::any2_iterator i (es.begin ()); i != es.end (); ++i)
+ {
+ cout << xml::transcode<char> (i->getTextContent ()) << endl;
+ }
+
+ cout << endl;
+}
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ // Test accessors/modifiers for various cardinalities.
+ //
+ type t;
+
+ DOMDocument& doc (t.dom_document ());
+
+ // one
+ //
+ {
+ DOMElement* e (doc.createElement (xml::string ("a").c_str ()));
+ t.any (*e);
+ e->release ();
+ assert (xml::transcode<char> (t.any ().getTagName ()) == "a");
+
+ t.any (doc.createElement (xml::string ("b").c_str ()));
+ assert (xml::transcode<char> (t.any ().getTagName ()) == "b");
+ }
+
+ // optional
+ //
+ {
+ assert (!t.any1 ().present ());
+
+ DOMElement* e (doc.createElement (xml::string ("a").c_str ()));
+ t.any1 (*e);
+ e->release ();
+ assert (t.any1 ().present ());
+ assert (xml::transcode<char> (t.any1 ().get ().getTagName ()) == "a");
+
+ t.any1 (doc.createElement (xml::string ("b").c_str ()));
+ assert (xml::transcode<char> (t.any1 ()->getTagName ()) == "b");
+
+ type::any1_optional c (
+ doc.createElement (xml::string ("c").c_str ()), doc);
+ t.any1 (c);
+ assert (xml::transcode<char> (t.any1 ()->getTagName ()) == "c");
+ }
+
+
+ // sequence
+ //
+ {
+ type::any2_sequence& s (t.any2 ());
+
+ DOMElement* e (doc.createElement (xml::string ("a").c_str ()));
+ s.push_back (*e);
+ e->release ();
+ s.push_back (doc.createElement (xml::string ("b").c_str ()));
+ assert (s.size () == 2);
+
+ for (type::any2_iterator i (s.begin ()); i != s.end (); ++i)
+ {
+ if (i == s.begin ())
+ assert (xml::transcode<char> (i->getTagName ()) == "a");
+ else
+ assert (xml::transcode<char> ((*i).getTagName ()) == "b");
+ }
+
+ // copy c-tor
+ type::any2_sequence cs (s, doc);
+ assert (cs.size () == 2);
+ assert (xml::transcode<char> (cs[0].getTagName ()) == "a");
+ assert (xml::transcode<char> (cs[1].getTagName ()) == "b");
+
+ // assignment
+ t.any2 (cs);
+ assert (s.size () == 2);
+ assert (xml::transcode<char> (s[0].getTagName ()) == "a");
+ assert (xml::transcode<char> (s[1].getTagName ()) == "b");
+ }
+
+ // anyAttribute
+ //
+ {
+ type::any_attribute_set& s (t.any_attribute ());
+
+ DOMAttr* a (doc.createAttribute (xml::string ("a").c_str ()));
+ s.insert (*a);
+ a->release ();
+ s.insert (doc.createAttribute (xml::string ("b").c_str ()));
+ assert (s.size () == 2);
+
+ assert (s.find ("a") != s.end ());
+ assert (s.find ("b") != s.end ());
+
+ for (type::any_attribute_iterator i (s.begin ()); i != s.end (); ++i)
+ {
+ assert (xml::transcode<char> (i->getName ()) == "a" ||
+ xml::transcode<char> ((*i).getName ()) == "b");
+ }
+
+ // copy c-tor
+ type::any_attribute_set cs (s, doc);
+ assert (cs.size () == 2);
+ assert (cs.count ("a"));
+ assert (cs.count ("b"));
+
+ // assignment
+ t.any_attribute (cs);
+ assert (s.size () == 2);
+ assert (s.count ("a"));
+ assert (s.count ("b"));
+ }
+
+ // Test parsing
+ //
+ XSD_AUTO_PTR<type> r (root (argv[1]));
+ print (*r);
+
+ // Test serialization.
+ //
+ xml_schema::namespace_infomap map;
+
+ map["t"].name = "test";
+ map["t"].schema = "test.xsd";
+ map["o"].name = "other";
+
+ stringstream iostr;
+ root (iostr, *r, map);
+
+ // cout << iostr.str () << endl
+ // << endl;
+
+ XSD_AUTO_PTR<type> copy (root (iostr, argv[1]));
+ assert (*copy == *r);
+
+ print (*copy);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Terminate ();
+}
diff --git a/xsd-tests/cxx/tree/wildcard/output b/xsd-tests/cxx/tree/wildcard/output
new file mode 100644
index 0000000..b23b488
--- /dev/null
+++ b/xsd-tests/cxx/tree/wildcard/output
@@ -0,0 +1,24 @@
+att
+any
+o:any
+t:any
+o:one
+foo
+t:bar
+bar
+o:one1
+o:one2
+o:one3
+
+att
+any
+o:any
+t:any
+o:one
+foo
+t:bar
+bar
+o:one1
+o:one2
+o:one3
+
diff --git a/xsd-tests/cxx/tree/wildcard/test.xml b/xsd-tests/cxx/tree/wildcard/test.xml
new file mode 100644
index 0000000..b0c3267
--- /dev/null
+++ b/xsd-tests/cxx/tree/wildcard/test.xml
@@ -0,0 +1,19 @@
+<t:root xmlns:t="test"
+ xmlns:o="other"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="test test.xsd"
+
+ att="att"
+ any="any"
+ t:any="t:any"
+ o:any="o:any">
+
+ <o:one>o:one</o:one>
+ <foo>foo</foo>
+ <t:bar>t:bar</t:bar>
+ <bar>bar</bar>
+ <o:seq1>o:one1</o:seq1>
+ <o:seq2>o:one2</o:seq2>
+ <o:seq3>o:one3</o:seq3>
+
+</t:root>
diff --git a/xsd-tests/cxx/tree/wildcard/test.xsd b/xsd-tests/cxx/tree/wildcard/test.xsd
new file mode 100644
index 0000000..6c7b308
--- /dev/null
+++ b/xsd-tests/cxx/tree/wildcard/test.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <complexType name="type">
+ <sequence>
+ <any namespace="##other" processContents="skip"/>
+ <element name="foo" type="string"/>
+ <any namespace="##targetNamespace" minOccurs="0" processContents="skip"/>
+ <element name="bar" type="string"/>
+ <any namespace="##other" maxOccurs="unbounded" processContents="skip"/>
+ </sequence>
+ <attribute name="att" type="string"/>
+ <anyAttribute namespace="##any" processContents="skip"/>
+ </complexType>
+
+ <element name="root" type="t:type"/>
+
+</schema>
diff --git a/xsd-tests/failed/.gitignore b/xsd-tests/failed/.gitignore
new file mode 100644
index 0000000..f691ede
--- /dev/null
+++ b/xsd-tests/failed/.gitignore
@@ -0,0 +1 @@
+test-*.?xx
diff --git a/xsd-tests/failed/buildfile b/xsd-tests/failed/buildfile
new file mode 100644
index 0000000..8739001
--- /dev/null
+++ b/xsd-tests/failed/buildfile
@@ -0,0 +1,27 @@
+# file : failed/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = test-00
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/failed/driver.cxx b/xsd-tests/failed/driver.cxx
new file mode 100644
index 0000000..a84b24c
--- /dev/null
+++ b/xsd-tests/failed/driver.cxx
@@ -0,0 +1,9 @@
+// file : failed/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test-00.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/failed/test-00.xsd b/xsd-tests/failed/test-00.xsd
new file mode 100644
index 0000000..5223f82
--- /dev/null
+++ b/xsd-tests/failed/test-00.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:element name="foo">
+ <xsd:complexType/>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/xsd-tests/manifest b/xsd-tests/manifest
new file mode 100644
index 0000000..7e2e893
--- /dev/null
+++ b/xsd-tests/manifest
@@ -0,0 +1,15 @@
+: 1
+name: xsd-tests
+version: 4.2.0-b.1.z
+project: xsd
+summary: XML Schema to C++ data binding compiler tests
+license: other: GPL-2.0-only with Xerces-C++ linking exception and FLOSS exception
+description-file: README
+url: https://www.codesynthesis.com/projects/xsd/
+doc-url: https://www.codesynthesis.com/projects/xsd/
+src-url: https://git.codesynthesis.com/cgit/xsd/xsd/tree/xsd-tests/
+email: xsd-users@codesynthesis.com ; Mailing list
+depends: * build2 >= 0.13.0
+depends: * bpkg >= 0.13.0
+depends: libxsd == $
+depends: libxerces-c ^3.0.0
diff --git a/xsd-tests/morphing/anonymous/attribute-group/buildfile b/xsd-tests/morphing/anonymous/attribute-group/buildfile
new file mode 100644
index 0000000..3df24fc
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/attribute-group/buildfile
@@ -0,0 +1,22 @@
+# file : morphing/anonymous/attribute-group/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/morphing/anonymous/attribute-group/driver.cxx b/xsd-tests/morphing/anonymous/attribute-group/driver.cxx
new file mode 100644
index 0000000..1632d7d
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/attribute-group/driver.cxx
@@ -0,0 +1,9 @@
+// file : morphing/anonymous/attribute-group/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/morphing/anonymous/attribute-group/test.xsd b/xsd-tests/morphing/anonymous/attribute-group/test.xsd
new file mode 100644
index 0000000..657be8a
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/attribute-group/test.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Attribute Group that names anonymous type. -->
+
+ <xsd:attributeGroup name="gfoo-1">
+ <xsd:attribute name="afoo-1">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:attributeGroup>
+
+ <xsd:attributeGroup name="gfoo-2">
+ <xsd:attributeGroup ref="gfoo-1"/>
+ <xsd:attribute name="afoo-2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:complexType name="Foo1">
+ <xsd:attributeGroup ref="gfoo-1"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Foo2">
+ <xsd:attributeGroup ref="gfoo-2"/>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/basic/buildfile b/xsd-tests/morphing/anonymous/basic/buildfile
new file mode 100644
index 0000000..e2573e7
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/basic/buildfile
@@ -0,0 +1,22 @@
+# file : morphing/anonymous/basic/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/morphing/anonymous/basic/driver.cxx b/xsd-tests/morphing/anonymous/basic/driver.cxx
new file mode 100644
index 0000000..fc289eb
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/basic/driver.cxx
@@ -0,0 +1,9 @@
+// file : morphing/anonymous/basic/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/morphing/anonymous/basic/test.xsd b/xsd-tests/morphing/anonymous/basic/test.xsd
new file mode 100644
index 0000000..ce930d8
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/basic/test.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Test xpath for nested anonymous types. -->
+
+ <element name="a">
+ <complexType>
+ <sequence>
+ <element name="b">
+ <complexType>
+ <sequence>
+ <element name="c" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/xsd-tests/morphing/anonymous/cyclic-inclusion/.gitignore b/xsd-tests/morphing/anonymous/cyclic-inclusion/.gitignore
new file mode 100644
index 0000000..b27b7d8
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/cyclic-inclusion/.gitignore
@@ -0,0 +1,2 @@
+includee.?xx
+includer.?xx
diff --git a/xsd-tests/morphing/anonymous/cyclic-inclusion/buildfile b/xsd-tests/morphing/anonymous/cyclic-inclusion/buildfile
new file mode 100644
index 0000000..d25143a
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/cyclic-inclusion/buildfile
@@ -0,0 +1,27 @@
+# file : morphing/anonymous/cyclic-inclusion/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = includee includer
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/morphing/anonymous/cyclic-inclusion/driver.cxx b/xsd-tests/morphing/anonymous/cyclic-inclusion/driver.cxx
new file mode 100644
index 0000000..9046ee4
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/cyclic-inclusion/driver.cxx
@@ -0,0 +1,10 @@
+// file : morphing/anonymous/cyclic-inclusion/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "includee.hxx"
+#include "includer.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/morphing/anonymous/cyclic-inclusion/includee.xsd b/xsd-tests/morphing/anonymous/cyclic-inclusion/includee.xsd
new file mode 100644
index 0000000..51f7916
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/cyclic-inclusion/includee.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:t="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:include schemaLocation="includer.xsd"/>
+
+ <xsd:element name="bar">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="t:foo"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/cyclic-inclusion/includer.xsd b/xsd-tests/morphing/anonymous/cyclic-inclusion/includer.xsd
new file mode 100644
index 0000000..54e6b69
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/cyclic-inclusion/includer.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:t="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:include schemaLocation="includee.xsd"/>
+
+ <xsd:element name="foo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/group/buildfile b/xsd-tests/morphing/anonymous/group/buildfile
new file mode 100644
index 0000000..9cedf39
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/group/buildfile
@@ -0,0 +1,22 @@
+# file : morphing/anonymous/group/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/morphing/anonymous/group/driver.cxx b/xsd-tests/morphing/anonymous/group/driver.cxx
new file mode 100644
index 0000000..2a76396
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/group/driver.cxx
@@ -0,0 +1,9 @@
+// file : morphing/anonymous/group/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/morphing/anonymous/group/test.xsd b/xsd-tests/morphing/anonymous/group/test.xsd
new file mode 100644
index 0000000..73e07af
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/group/test.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Simple case. -->
+
+ <xsd:group name="gfoo">
+ <xsd:sequence>
+ <xsd:element name="foo-1">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:group>
+
+
+ <xsd:complexType name="Foo">
+ <xsd:group ref="gfoo"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Bar">
+ <xsd:group ref="gfoo"/>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/unstable/.gitignore b/xsd-tests/morphing/anonymous/unstable/.gitignore
new file mode 100644
index 0000000..c1b04fd
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/unstable/.gitignore
@@ -0,0 +1 @@
+includee-*.?xx
diff --git a/xsd-tests/morphing/anonymous/unstable/buildfile b/xsd-tests/morphing/anonymous/unstable/buildfile
new file mode 100644
index 0000000..e83cee7
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/unstable/buildfile
@@ -0,0 +1,31 @@
+# file : morphing/anonymous/unstable/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+fs = includee-1 includee-2
+
+./: {hxx cxx}{$fs}
+
+# Make sure that the schema files are compilable.
+#
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+# Test that the invalid schema files compilation expectedly fails.
+#
+./: testscript xsd{** -{$fs}} $xsd
+
+testscript{*}:
+{
+ test = $xsd
+ test.arguments = cxx-tree --std c++11
+}
diff --git a/xsd-tests/morphing/anonymous/unstable/includee-1.xsd b/xsd-tests/morphing/anonymous/unstable/includee-1.xsd
new file mode 100644
index 0000000..916816f
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/unstable/includee-1.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/unstable/includee-2.xsd b/xsd-tests/morphing/anonymous/unstable/includee-2.xsd
new file mode 100644
index 0000000..c0eda26
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/unstable/includee-2.xsd
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:element name="base">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/unstable/includer.xsd b/xsd-tests/morphing/anonymous/unstable/includer.xsd
new file mode 100644
index 0000000..4593b5f
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/unstable/includer.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:Test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:include schemaLocation="includee-1.xsd"/>
+ <xsd:include schemaLocation="includee-2.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/morphing/anonymous/unstable/testscript b/xsd-tests/morphing/anonymous/unstable/testscript
new file mode 100644
index 0000000..a9057e1
--- /dev/null
+++ b/xsd-tests/morphing/anonymous/unstable/testscript
@@ -0,0 +1,11 @@
+# file : morphing/anonymous/unstable/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+: unstable-conflict
+:
+$* --output-dir $~ $src_base/includer.xsd 2>>/"EOE" != 0
+ $src_base/includee-2.xsd:8:28: error: element name 'base' creates an unstable conflict when used as a type name
+ $src_base/includee-1.xsd:8:31: info: conflicting type is defined here
+ $src_base/includee-2.xsd:8:28: info: use --anonymous-regex to resolve this conflict
+ $src_base/includee-2.xsd:8:28: info: and don't forget to pass the same option when translating 'includee-2.xsd' and all the schemas that refer to it
+ EOE
diff --git a/xsd-tests/processing/inheritance/.gitignore b/xsd-tests/processing/inheritance/.gitignore
new file mode 100644
index 0000000..2c7adec
--- /dev/null
+++ b/xsd-tests/processing/inheritance/.gitignore
@@ -0,0 +1,3 @@
+driver-???
+driver-???.?xx
+test-*.?xx
diff --git a/xsd-tests/processing/inheritance/buildfile b/xsd-tests/processing/inheritance/buildfile
new file mode 100644
index 0000000..09e64a4
--- /dev/null
+++ b/xsd-tests/processing/inheritance/buildfile
@@ -0,0 +1,36 @@
+# file : processing/inheritance/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+for nm: 000 001
+{
+ dr = "driver-$nm"
+ sc = "test-$nm"
+
+ ./: exe{$dr}: cxx{$dr} {hxx cxx}{$sc} $libs
+
+ cxx{$dr}: in{driver}
+ {
+ # Note: we can't use $nm$ in driver.cxx.in since it will be substituted by
+ # the latest $nm value.
+ #
+ num = $nm
+ }
+
+ <{hxx cxx}{$sc}>: xsd{$sc} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/processing/inheritance/driver.cxx.in b/xsd-tests/processing/inheritance/driver.cxx.in
new file mode 100644
index 0000000..df18427
--- /dev/null
+++ b/xsd-tests/processing/inheritance/driver.cxx.in
@@ -0,0 +1,9 @@
+// file : processing/inheritance/driver.cxx.in
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test-$num$.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/processing/inheritance/test-000.xsd b/xsd-tests/processing/inheritance/test-000.xsd
new file mode 100644
index 0000000..ef1ef71
--- /dev/null
+++ b/xsd-tests/processing/inheritance/test-000.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Type base "depends" on itself via e element -->
+
+ <element name="e">
+ <complexType>
+ <complexContent>
+ <extension base="t:base"/>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <complexType name="base">
+ <sequence>
+ <element ref="t:e"/>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:base"/>
+
+</schema>
diff --git a/xsd-tests/processing/inheritance/test-001.xsd b/xsd-tests/processing/inheritance/test-001.xsd
new file mode 100644
index 0000000..5afc997
--- /dev/null
+++ b/xsd-tests/processing/inheritance/test-001.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Type base depends on derived which in turn depends on base -->
+
+ <complexType name="derived">
+ <complexContent>
+ <extension base="t:base"/>
+ </complexContent>
+ </complexType>
+
+ <complexType name="base">
+ <sequence>
+ <element name="e">
+ <complexType>
+ <complexContent>
+ <extension base="t:derived"/>
+ </complexContent>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <element name="root" type="t:base"/>
+
+</schema>
diff --git a/xsd-tests/schema/anonymous/buildfile b/xsd-tests/schema/anonymous/buildfile
new file mode 100644
index 0000000..cc01697
--- /dev/null
+++ b/xsd-tests/schema/anonymous/buildfile
@@ -0,0 +1,22 @@
+# file : schema/anonymous/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/anonymous/driver.cxx b/xsd-tests/schema/anonymous/driver.cxx
new file mode 100644
index 0000000..f902fdb
--- /dev/null
+++ b/xsd-tests/schema/anonymous/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/anonymous/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/anonymous/test.xsd b/xsd-tests/schema/anonymous/test.xsd
new file mode 100644
index 0000000..cba3300
--- /dev/null
+++ b/xsd-tests/schema/anonymous/test.xsd
@@ -0,0 +1,143 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Test 'type' name escaping. -->
+ <xsd:element name="type">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <!-- Anonymous type via global element. -->
+ <xsd:element name="global_element">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <!-- Anonymous type via global attribute. -->
+ <xsd:attribute name="global_attribute">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+
+
+ <!-- Anonymous type via local element. -->
+ <xsd:complexType name="local_element_type">
+ <xsd:sequence>
+ <xsd:element name="local_element">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+
+ <!-- Anonymous type via local attribute. -->
+ <xsd:complexType name="local_attribute_type">
+ <xsd:attribute name="local_attribute">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+
+<!--
+
+ Various weird anonymous type combinations (some of them are fruits of a
+ really sick imagination).
+
+-->
+
+ <xsd:element name="tasks">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:periodicTask"/>
+ <xsd:element ref="test:braindamageTask"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="periodicTask">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:tasks"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="braindamageTask">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:tasks"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:complexType name="PropertySeq">
+ <xsd:sequence>
+ <xsd:element name="propery">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="value">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="typecode">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="string"/>
+ <xsd:enumeration value="integer"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="content" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:element name="periods">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="period" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="typecode">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="string"/>
+ <xsd:enumeration value="integer"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+</xsd:schema>
diff --git a/xsd-tests/schema/any-attribute/buildfile b/xsd-tests/schema/any-attribute/buildfile
new file mode 100644
index 0000000..e4275a4
--- /dev/null
+++ b/xsd-tests/schema/any-attribute/buildfile
@@ -0,0 +1,12 @@
+# file : schema/any-attribute/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Test that the invalid schema files compilation expectedly fails.
+#
+./: testscript xsd{*} $xsd
+
+testscript{*}:
+{
+ test = $xsd
+ test.arguments = cxx-tree --std c++11
+}
diff --git a/xsd-tests/schema/any-attribute/test.xsd b/xsd-tests/schema/any-attribute/test.xsd
new file mode 100644
index 0000000..55419c4
--- /dev/null
+++ b/xsd-tests/schema/any-attribute/test.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+
+ <xsd:complexType name="type">
+ <xsd:attribute name="a" type="xsd:string"/>
+ <xsd:anyAttribute namespace="##other" processContents="skip"/>
+ <xsd:attributeGroup ref="test:agroup"/>
+ </xsd:complexType>
+
+ <xsd:attributeGroup name="agroup">
+ <xsd:attribute name="b" type="xsd:string"/>
+ <xsd:anyAttribute namespace="##any" processContents="skip"/>
+ </xsd:attributeGroup>
+
+ <xsd:element name="root" type="test:type"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/any-attribute/testscript b/xsd-tests/schema/any-attribute/testscript
new file mode 100644
index 0000000..d9da7c1
--- /dev/null
+++ b/xsd-tests/schema/any-attribute/testscript
@@ -0,0 +1,8 @@
+# file : schema/any-attribute/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+: decl-after-any-attribute
+:
+$* --output-dir $~ $src_base/test.xsd 2>>/"EOE" != 0
+ $src_base/test.xsd:12:44: error: anyAttribute must not be followed by other declarations
+ EOE
diff --git a/xsd-tests/schema/any-type/buildfile b/xsd-tests/schema/any-type/buildfile
new file mode 100644
index 0000000..e575562
--- /dev/null
+++ b/xsd-tests/schema/any-type/buildfile
@@ -0,0 +1,24 @@
+# file : schema/any-type/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0]) 2>>?~%EOE%
+ %.+(warning F00\d|info):.+%.+
+ EOE
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/any-type/driver.cxx b/xsd-tests/schema/any-type/driver.cxx
new file mode 100644
index 0000000..a94f099
--- /dev/null
+++ b/xsd-tests/schema/any-type/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/any-type/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/any-type/test.xsd b/xsd-tests/schema/any-type/test.xsd
new file mode 100644
index 0000000..9e3ff79
--- /dev/null
+++ b/xsd-tests/schema/any-type/test.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:complexType name="person">
+ <xsd:sequence>
+ <xsd:element name="name"/> <!-- type="anyType" -->
+ <xsd:element name="name2" type="xsd:anyType" minOccurs="0"/>
+ <xsd:element name="name3" type="xsd:anyType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"/> <!-- type="anySimpleType" -->
+ <xsd:attribute name="id2" type="xsd:anySimpleType" use="required"/>
+ </xsd:complexType>
+
+ <xsd:element name="person" type="test:person"/>
+
+ <xsd:element name="name"/> <!-- type="anyType" -->
+
+</xsd:schema>
diff --git a/xsd-tests/schema/any/.gitignore b/xsd-tests/schema/any/.gitignore
new file mode 100644
index 0000000..fca6147
--- /dev/null
+++ b/xsd-tests/schema/any/.gitignore
@@ -0,0 +1,5 @@
+driver-test
+driver-fail
+driver-test.?xx
+driver-fail.?xx
+fail.?xx
diff --git a/xsd-tests/schema/any/buildfile b/xsd-tests/schema/any/buildfile
new file mode 100644
index 0000000..6b76348
--- /dev/null
+++ b/xsd-tests/schema/any/buildfile
@@ -0,0 +1,47 @@
+# file : schema/any/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+for sc: test fail
+{
+ dr = "driver-$sc"
+
+ ./: exe{$dr}: cxx{$dr} {hxx cxx}{$sc} $libs
+
+ cxx{$dr}: in{driver}
+ {
+ # Note: we can't use $sc$ in driver.cxx.in since it will be substituted by
+ # the latest $sc value.
+ #
+ sch = $sc
+ }
+}
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+<{hxx cxx}{fail}>: xsd{fail} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0]) 2>>?~%EOE%
+ %.+(warning T001:|info:).+%{9}
+ EOE
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/any/driver.cxx.in b/xsd-tests/schema/any/driver.cxx.in
new file mode 100644
index 0000000..9c36761
--- /dev/null
+++ b/xsd-tests/schema/any/driver.cxx.in
@@ -0,0 +1,9 @@
+// file : schema/any/driver.cxx.in
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "$sch$.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/any/fail.xsd b/xsd-tests/schema/any/fail.xsd
new file mode 100644
index 0000000..2eb9513
--- /dev/null
+++ b/xsd-tests/schema/any/fail.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:element name="foo" type="xsd:string"/>
+
+ <xsd:complexType name="person">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element ref="test:foo"/>
+ <xsd:any namespace="##any" processContents="strict"/>
+ <xsd:any namespace="http://www.codesynthesis.com/xmlns/test" processContents="strict"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/any/test.xsd b/xsd-tests/schema/any/test.xsd
new file mode 100644
index 0000000..ff896fd
--- /dev/null
+++ b/xsd-tests/schema/any/test.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:complexType name="person">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:any namespace="##other" processContents="strict" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:anyAttribute namespace="##other" processContents="strict"/>
+ </xsd:complexType>
+
+ <xsd:element name="person" type="test:person"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/attribute-group/.gitignore b/xsd-tests/schema/attribute-group/.gitignore
new file mode 100644
index 0000000..a935c30
--- /dev/null
+++ b/xsd-tests/schema/attribute-group/.gitignore
@@ -0,0 +1 @@
+global.?xx
diff --git a/xsd-tests/schema/attribute-group/buildfile b/xsd-tests/schema/attribute-group/buildfile
new file mode 100644
index 0000000..b9ca83b
--- /dev/null
+++ b/xsd-tests/schema/attribute-group/buildfile
@@ -0,0 +1,22 @@
+# file : schema/attribute-group/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -global} {hxx cxx}{global} $libs
+
+<{hxx cxx}{global}>: xsd{global} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/attribute-group/driver.cxx b/xsd-tests/schema/attribute-group/driver.cxx
new file mode 100644
index 0000000..328cef4
--- /dev/null
+++ b/xsd-tests/schema/attribute-group/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/attribute-group/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "global.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/attribute-group/global.xsd b/xsd-tests/schema/attribute-group/global.xsd
new file mode 100644
index 0000000..6ee0539
--- /dev/null
+++ b/xsd-tests/schema/attribute-group/global.xsd
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Simple case. -->
+
+ <xsd:attributeGroup name="gfoo_1">
+ <xsd:attribute name="foo_1_1" type="xsd:string"/>
+ <xsd:attribute name="foo_1_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:attributeGroup name="gfoo_2">
+ <xsd:attributeGroup ref="gfoo_1"/>
+ <xsd:attribute name="foo_2_1" type="xsd:string"/>
+ <xsd:attribute name="foo_2_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:complexType name="Foo">
+ <xsd:attributeGroup ref="gfoo_2"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference. -->
+
+ <xsd:attributeGroup name="gbar_3">
+ <xsd:attribute name="bar_3_1" type="xsd:string"/>
+ <xsd:attribute name="bar_3_2" type="xsd:string"/>
+ <xsd:attributeGroup ref="gbar_1"/>
+ </xsd:attributeGroup>
+
+ <xsd:complexType name="Bar">
+ <xsd:attributeGroup ref="gbar_2"/>
+ </xsd:complexType>
+
+ <xsd:attributeGroup name="gbar_2">
+ <xsd:attributeGroup ref="gbar_3"/>
+ <xsd:attribute name="bar_2_1" type="xsd:string"/>
+ <xsd:attribute name="bar_2_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:attributeGroup name="gbar_1">
+ <xsd:attribute name="bar_1_1" type="xsd:string"/>
+ <xsd:attribute name="bar_1_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/attribute/.gitignore b/xsd-tests/schema/attribute/.gitignore
new file mode 100644
index 0000000..88cd012
--- /dev/null
+++ b/xsd-tests/schema/attribute/.gitignore
@@ -0,0 +1,3 @@
+global.?xx
+local.?xx
+ref.?xx
diff --git a/xsd-tests/schema/attribute/buildfile b/xsd-tests/schema/attribute/buildfile
new file mode 100644
index 0000000..00e5410
--- /dev/null
+++ b/xsd-tests/schema/attribute/buildfile
@@ -0,0 +1,27 @@
+# file : schema/attribute/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = global local ref
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/attribute/driver.cxx b/xsd-tests/schema/attribute/driver.cxx
new file mode 100644
index 0000000..3d29b36
--- /dev/null
+++ b/xsd-tests/schema/attribute/driver.cxx
@@ -0,0 +1,11 @@
+// file : schema/attribute/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "ref.hxx"
+#include "global.hxx"
+#include "local.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/attribute/global.xsd b/xsd-tests/schema/attribute/global.xsd
new file mode 100644
index 0000000..e2dcc93
--- /dev/null
+++ b/xsd-tests/schema/attribute/global.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Typed with named type. -->
+
+ <xsd:attribute name="foo" type="xsd:string"/>
+
+
+ <!-- Typed with anonymous type. -->
+
+ <xsd:attribute name="bar">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/attribute/local.xsd b/xsd-tests/schema/attribute/local.xsd
new file mode 100644
index 0000000..7a7a480
--- /dev/null
+++ b/xsd-tests/schema/attribute/local.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+
+ <!-- Typed with named type. -->
+
+ <xsd:complexType name="Foo">
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:complexType>
+
+
+ <!-- Forward reference to a yet undeclared type. -->
+
+ <xsd:complexType name="Bar">
+ <xsd:attribute name="bar" type="Bar2"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Bar2">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+
+ <!-- Typed with anonymous type. -->
+
+ <xsd:complexType name="Baz">
+ <xsd:attribute name="baz">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/attribute/ref.xsd b/xsd-tests/schema/attribute/ref.xsd
new file mode 100644
index 0000000..d806ff3
--- /dev/null
+++ b/xsd-tests/schema/attribute/ref.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+
+ <!-- Easy case. -->
+
+ <xsd:attribute name="foo" type="xsd:string"/>
+
+ <xsd:complexType name="Foo2">
+ <xsd:attribute ref="foo"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference to a yet undeclared attribute. -->
+
+ <xsd:complexType name="Bar3">
+ <xsd:attribute ref="bar"/>
+ </xsd:complexType>
+
+ <xsd:attribute name="bar" type="xsd:string"/>
+
+
+
+ <!-- Reference to an attribute with a forward reference to a yet
+ undeclared type. -->
+
+ <xsd:attribute name="baz" type="Baz2"/>
+
+ <xsd:complexType name="Baz3">
+ <xsd:attribute ref="baz"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Baz2">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/cardinality/buildfile b/xsd-tests/schema/cardinality/buildfile
new file mode 100644
index 0000000..cfbb732
--- /dev/null
+++ b/xsd-tests/schema/cardinality/buildfile
@@ -0,0 +1,22 @@
+# file : schema/cardinality/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/cardinality/driver.cxx b/xsd-tests/schema/cardinality/driver.cxx
new file mode 100644
index 0000000..d8b218e
--- /dev/null
+++ b/xsd-tests/schema/cardinality/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/cardinality/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/cardinality/test.xsd b/xsd-tests/schema/cardinality/test.xsd
new file mode 100644
index 0000000..b27f923
--- /dev/null
+++ b/xsd-tests/schema/cardinality/test.xsd
@@ -0,0 +1,46 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!--
+ This test tries to cover various cardinality cases with
+ built-in and user-defined types.
+ -->
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element name="foo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Bar">
+ <xsd:sequence>
+
+ <xsd:element name="one-int" type="xsd:int"/>
+ <xsd:element name="opt-int" type="xsd:int" minOccurs="0"/>
+ <xsd:element name="seq-int" type="xsd:int" maxOccurs="unbounded"/>
+
+ <xsd:element name="one-string" type="xsd:string"/>
+ <xsd:element name="opt-string" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="seq-string" type="xsd:string" maxOccurs="unbounded"/>
+
+ <xsd:element name="one-foo" type="test:Foo"/>
+ <xsd:element name="opt-foo" type="test:Foo" minOccurs="0"/>
+ <xsd:element name="seq-foo" type="test:Foo" maxOccurs="unbounded"/>
+
+ </xsd:sequence>
+
+ <xsd:attribute name="one-int-a" type="xsd:int" use="required"/>
+ <xsd:attribute name="opt-int-a" type="xsd:int"/>
+
+ <xsd:attribute name="one-string-a" type="xsd:string" use="required"/>
+ <xsd:attribute name="opt-string-a" type="xsd:string"/>
+
+ </xsd:complexType>
+
+ <xsd:element name="bar" type="test:Bar"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/chameleon/.gitignore b/xsd-tests/schema/chameleon/.gitignore
new file mode 100644
index 0000000..4ec7484
--- /dev/null
+++ b/xsd-tests/schema/chameleon/.gitignore
@@ -0,0 +1 @@
+includer.?xx
diff --git a/xsd-tests/schema/chameleon/buildfile b/xsd-tests/schema/chameleon/buildfile
new file mode 100644
index 0000000..0143422
--- /dev/null
+++ b/xsd-tests/schema/chameleon/buildfile
@@ -0,0 +1,27 @@
+# file : schema/chameleon/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = includer schemas/includee
+
+exe{driver}: {hxx cxx}{** -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $directory($path($>[0])) \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/chameleon/driver.cxx b/xsd-tests/schema/chameleon/driver.cxx
new file mode 100644
index 0000000..7b408ef
--- /dev/null
+++ b/xsd-tests/schema/chameleon/driver.cxx
@@ -0,0 +1,10 @@
+// file : schema/chameleon/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "includer.hxx"
+#include "schemas/includee.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/chameleon/includer.xsd b/xsd-tests/schema/chameleon/includer.xsd
new file mode 100644
index 0000000..c93ea18
--- /dev/null
+++ b/xsd-tests/schema/chameleon/includer.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:Test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:include schemaLocation="schemas/includee.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/chameleon/schemas/.gitignore b/xsd-tests/schema/chameleon/schemas/.gitignore
new file mode 100644
index 0000000..dcf4bb9
--- /dev/null
+++ b/xsd-tests/schema/chameleon/schemas/.gitignore
@@ -0,0 +1 @@
+includee.?xx
diff --git a/xsd-tests/schema/chameleon/schemas/includee.xsd b/xsd-tests/schema/chameleon/schemas/includee.xsd
new file mode 100644
index 0000000..d89b9c4
--- /dev/null
+++ b/xsd-tests/schema/chameleon/schemas/includee.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd">
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="base_e" type="base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/enumeration/buildfile b/xsd-tests/schema/enumeration/buildfile
new file mode 100644
index 0000000..efb6b9e
--- /dev/null
+++ b/xsd-tests/schema/enumeration/buildfile
@@ -0,0 +1,22 @@
+# file : schema/enumeration/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/enumeration/driver.cxx b/xsd-tests/schema/enumeration/driver.cxx
new file mode 100644
index 0000000..406c8ab
--- /dev/null
+++ b/xsd-tests/schema/enumeration/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/enumeration/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/enumeration/test.xsd b/xsd-tests/schema/enumeration/test.xsd
new file mode 100644
index 0000000..b8253d9
--- /dev/null
+++ b/xsd-tests/schema/enumeration/test.xsd
@@ -0,0 +1,89 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- string-based -->
+
+ <xsd:simpleType name="StringEnum">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="one"/>
+ <xsd:enumeration value="two"/>
+ <xsd:enumeration value="three"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="StringSimple">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a simple type -->
+ <xsd:simpleType name="StringSimpleRestriction">
+ <xsd:restriction base="test:StringSimple">
+ <xsd:enumeration value="one"/>
+ <xsd:enumeration value="two"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a strig-based enum -->
+ <xsd:simpleType name="StringEnumRestriction">
+ <xsd:restriction base="test:StringEnum">
+ <xsd:enumeration value="one"/>
+ <xsd:enumeration value="two"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a complex type from a string-based enum -->
+ <xsd:complexType name="StringComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:StringEnumRestriction">
+ <xsd:attribute name="lang" type="xsd:language"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+
+ <!-- non string-based -->
+
+ <xsd:simpleType name="IntEnum">
+ <xsd:restriction base="xsd:int">
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="2"/>
+ <xsd:enumeration value="3"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="IntSimple">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a simple type -->
+ <xsd:simpleType name="IntSimpleRestriction">
+ <xsd:restriction base="test:IntSimple">
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="2"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a enum -->
+ <xsd:simpleType name="IntEnumRestriction">
+ <xsd:restriction base="test:IntEnum">
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="2"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a complex type from a enum -->
+ <xsd:complexType name="IntComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntEnumRestriction">
+ <xsd:attribute name="lang" type="xsd:language"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+</xsd:schema>
diff --git a/xsd-tests/schema/forward/buildfile b/xsd-tests/schema/forward/buildfile
new file mode 100644
index 0000000..969f99f
--- /dev/null
+++ b/xsd-tests/schema/forward/buildfile
@@ -0,0 +1,22 @@
+# file : schema/forward/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/forward/driver.cxx b/xsd-tests/schema/forward/driver.cxx
new file mode 100644
index 0000000..ee6519e
--- /dev/null
+++ b/xsd-tests/schema/forward/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/forward/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/forward/test.xsd b/xsd-tests/schema/forward/test.xsd
new file mode 100644
index 0000000..c7cc24e
--- /dev/null
+++ b/xsd-tests/schema/forward/test.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+<!--
+
+ Various weird forward reference combinations.
+
+-->
+
+ <!-- case 1 -->
+
+ <xsd:complexType name="Type1A">
+ <xsd:complexContent>
+ <xsd:extension base="test:Type1B">
+ <xsd:sequence>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="Type1B">
+ <xsd:sequence>
+ <xsd:element name="foo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/group/.gitignore b/xsd-tests/schema/group/.gitignore
new file mode 100644
index 0000000..a935c30
--- /dev/null
+++ b/xsd-tests/schema/group/.gitignore
@@ -0,0 +1 @@
+global.?xx
diff --git a/xsd-tests/schema/group/buildfile b/xsd-tests/schema/group/buildfile
new file mode 100644
index 0000000..dd926dd
--- /dev/null
+++ b/xsd-tests/schema/group/buildfile
@@ -0,0 +1,27 @@
+# file : schema/group/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = test global
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/group/driver.cxx b/xsd-tests/schema/group/driver.cxx
new file mode 100644
index 0000000..e754194
--- /dev/null
+++ b/xsd-tests/schema/group/driver.cxx
@@ -0,0 +1,10 @@
+// file : schema/group/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+#include "global.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/group/global.xsd b/xsd-tests/schema/group/global.xsd
new file mode 100644
index 0000000..27ccadf
--- /dev/null
+++ b/xsd-tests/schema/group/global.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Simple case. -->
+
+ <xsd:group name="gfoo">
+ <xsd:sequence>
+ <xsd:element name="foo_1" type="xsd:string"/>
+ <xsd:element name="foo_2" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:group>
+
+
+ <xsd:complexType name="Foo">
+ <xsd:group ref="gfoo"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference. -->
+
+ <xsd:complexType name="Bar">
+ <xsd:group ref="gbar"/>
+ </xsd:complexType>
+
+ <xsd:group name="gbar">
+ <xsd:choice>
+ <xsd:element name="bar_1" type="xsd:string"/>
+ <xsd:element ref="bar_2"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:element name="bar_2" type="xsd:string"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/group/test.xsd b/xsd-tests/schema/group/test.xsd
new file mode 100644
index 0000000..7527cbb
--- /dev/null
+++ b/xsd-tests/schema/group/test.xsd
@@ -0,0 +1,148 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!--
+
+ Various weird group combinations.
+
+ -->
+
+ <!-- case 1 -->
+
+ <xsd:group name="g1">
+ <xsd:sequence>
+ <xsd:element name="e1" type="xsd:string"/>
+ <xsd:element name="e2" type="xsd:long"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="Type1">
+ <xsd:sequence>
+ <xsd:group ref="test:g1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- case 2 -->
+
+ <xsd:group name="g2">
+ <xsd:sequence>
+ <xsd:element ref="test:g2e1"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="TypeTwo">
+ <xsd:sequence>
+ <xsd:group ref="test:g2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="g2e1" type="xsd:string"/>
+
+ <!-- case 3 -->
+
+ <xsd:complexType name="Type3">
+ <xsd:sequence>
+ <xsd:group ref="test:g3"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:group name="g3">
+ <xsd:sequence>
+ <xsd:element ref="test:g3e1"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:element name="g3e1" type="xsd:string"/>
+
+ <!-- case 4 -->
+
+ <xsd:complexType name="Type4A">
+ <xsd:sequence>
+ <xsd:group ref="test:g4" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Type4B">
+ <xsd:sequence minOccurs="0">
+ <xsd:group ref="test:g4"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:group name="g4">
+ <xsd:sequence>
+ <xsd:element name="e1" type="xsd:string"/>
+ <xsd:element name="e2" type="xsd:long" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="Type4C">
+ <xsd:sequence>
+ <xsd:group ref="test:g4" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- case 5 -->
+
+ <xsd:group name="g5-1">
+ <xsd:choice>
+ <xsd:group ref="test:g5-2"/>
+ <xsd:element name="e1" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:group name="g5-2">
+ <xsd:choice>
+ <xsd:group ref="test:g5-3"/>
+ <xsd:element name="e2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:group name="g5-3">
+ <xsd:choice>
+ <xsd:element name="e3" type="xsd:long"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="Type5">
+ <xsd:choice>
+ <xsd:group ref="test:g5-1"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <!-- case 6 -->
+
+ <xsd:group name="g6-3">
+ <xsd:choice>
+ <xsd:group ref="test:g6-1"/>
+ <xsd:element name="e_3_1" type="xsd:string"/>
+ <xsd:element name="e_3_2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="Type6">
+ <xsd:choice>
+ <xsd:group ref="test:g6-2"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:group name="g6-2">
+ <xsd:choice>
+ <xsd:group ref="test:g6-3"/>
+ <xsd:element name="e_2_1" type="xsd:string"/>
+ <xsd:element name="e_2_2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:group name="g6-1">
+ <xsd:choice>
+ <xsd:element name="e_1_1" type="xsd:string"/>
+ <xsd:element name="e_1_2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/import/.gitignore b/xsd-tests/schema/import/.gitignore
new file mode 100644
index 0000000..6cdf6db
--- /dev/null
+++ b/xsd-tests/schema/import/.gitignore
@@ -0,0 +1 @@
+importer.?xx
diff --git a/xsd-tests/schema/import/buildfile b/xsd-tests/schema/import/buildfile
new file mode 100644
index 0000000..9e6aec5
--- /dev/null
+++ b/xsd-tests/schema/import/buildfile
@@ -0,0 +1,27 @@
+# file : schema/import/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = importer schemas/importee
+
+exe{driver}: {hxx cxx}{** -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $directory($path($>[0])) \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/import/driver.cxx b/xsd-tests/schema/import/driver.cxx
new file mode 100644
index 0000000..a94b2f3
--- /dev/null
+++ b/xsd-tests/schema/import/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/import/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "importer.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/import/importer.xsd b/xsd-tests/schema/import/importer.xsd
new file mode 100644
index 0000000..82fc33c
--- /dev/null
+++ b/xsd-tests/schema/import/importer.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:Test="http://www.codesynthesis.com/xmlns/test"
+ xmlns:Impl="http://www.codesynthesis.com/xmlns/test/impl"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test/impl">
+
+ <!-- <xsd::element name="foo" type="xsd:string"/> -->
+
+ <xsd:import namespace="http://www.codesynthesis.com/xmlns/test" schemaLocation="schemas/importee.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/import/schemas/.gitignore b/xsd-tests/schema/import/schemas/.gitignore
new file mode 100644
index 0000000..945fcfc
--- /dev/null
+++ b/xsd-tests/schema/import/schemas/.gitignore
@@ -0,0 +1 @@
+importee.?xx
diff --git a/xsd-tests/schema/import/schemas/importee.xsd b/xsd-tests/schema/import/schemas/importee.xsd
new file mode 100644
index 0000000..9b03315
--- /dev/null
+++ b/xsd-tests/schema/import/schemas/importee.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="base_e" type="test:base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/include/.gitignore b/xsd-tests/schema/include/.gitignore
new file mode 100644
index 0000000..4ec7484
--- /dev/null
+++ b/xsd-tests/schema/include/.gitignore
@@ -0,0 +1 @@
+includer.?xx
diff --git a/xsd-tests/schema/include/buildfile b/xsd-tests/schema/include/buildfile
new file mode 100644
index 0000000..904e819
--- /dev/null
+++ b/xsd-tests/schema/include/buildfile
@@ -0,0 +1,27 @@
+# file : schema/include/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+fs = includer schemas/includee
+
+exe{driver}: {hxx cxx}{** -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $directory($path($>[0])) \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/include/driver.cxx b/xsd-tests/schema/include/driver.cxx
new file mode 100644
index 0000000..779d9d6
--- /dev/null
+++ b/xsd-tests/schema/include/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/include/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "includer.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/include/includer.xsd b/xsd-tests/schema/include/includer.xsd
new file mode 100644
index 0000000..c93ea18
--- /dev/null
+++ b/xsd-tests/schema/include/includer.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:Test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:include schemaLocation="schemas/includee.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/include/schemas/.gitignore b/xsd-tests/schema/include/schemas/.gitignore
new file mode 100644
index 0000000..dcf4bb9
--- /dev/null
+++ b/xsd-tests/schema/include/schemas/.gitignore
@@ -0,0 +1 @@
+includee.?xx
diff --git a/xsd-tests/schema/include/schemas/includee.xsd b/xsd-tests/schema/include/schemas/includee.xsd
new file mode 100644
index 0000000..0a928f5
--- /dev/null
+++ b/xsd-tests/schema/include/schemas/includee.xsd
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="base_e" type="test:base"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/inheritance/.gitignore b/xsd-tests/schema/inheritance/.gitignore
new file mode 100644
index 0000000..9891c35
--- /dev/null
+++ b/xsd-tests/schema/inheritance/.gitignore
@@ -0,0 +1 @@
+cycle.?xx
diff --git a/xsd-tests/schema/inheritance/buildfile b/xsd-tests/schema/inheritance/buildfile
new file mode 100644
index 0000000..48c6dde
--- /dev/null
+++ b/xsd-tests/schema/inheritance/buildfile
@@ -0,0 +1,30 @@
+# file : schema/inheritance/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+fs = cycle sourced-forward/includer
+
+./: {hxx cxx}{$fs}
+
+# Make sure that the schema files are compilable.
+#
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --output-dir $directory($path($>[0])) \
+ $path($<[0])
+ }}
+}
+
+# Test that the invalid schema files compilation expectedly fails.
+#
+./: testscript xsd{** -{$fs}} $xsd
+
+testscript{*}:
+{
+ test = $xsd
+ test.arguments = cxx-tree --std c++11
+}
diff --git a/xsd-tests/schema/inheritance/cycle.xsd b/xsd-tests/schema/inheritance/cycle.xsd
new file mode 100644
index 0000000..c705311
--- /dev/null
+++ b/xsd-tests/schema/inheritance/cycle.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:complexType name="Base">
+ <xsd:sequence>
+ <xsd:element name="e1">
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="test:Derived">
+ <xsd:sequence>
+ <xsd:element name="e2" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Derived">
+ <xsd:complexContent>
+ <xsd:extension base="test:Base">
+ <xsd:sequence>
+ <xsd:element name="e3" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/inheritance/sourced-forward/.gitignore b/xsd-tests/schema/inheritance/sourced-forward/.gitignore
new file mode 100644
index 0000000..4ec7484
--- /dev/null
+++ b/xsd-tests/schema/inheritance/sourced-forward/.gitignore
@@ -0,0 +1 @@
+includer.?xx
diff --git a/xsd-tests/schema/inheritance/sourced-forward/includee.xsd b/xsd-tests/schema/inheritance/sourced-forward/includee.xsd
new file mode 100644
index 0000000..531027d
--- /dev/null
+++ b/xsd-tests/schema/inheritance/sourced-forward/includee.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd">
+
+ <xsd:simpleType name="Derived">
+ <xsd:restriction base="Base"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/inheritance/sourced-forward/includer.xsd b/xsd-tests/schema/inheritance/sourced-forward/includer.xsd
new file mode 100644
index 0000000..7d18efc
--- /dev/null
+++ b/xsd-tests/schema/inheritance/sourced-forward/includer.xsd
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:include schemaLocation="includee.xsd"/>
+
+ <xsd:simpleType name="Base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/inheritance/testscript b/xsd-tests/schema/inheritance/testscript
new file mode 100644
index 0000000..5cc649d
--- /dev/null
+++ b/xsd-tests/schema/inheritance/testscript
@@ -0,0 +1,8 @@
+# file : schema/inheritance/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+: base-not-found
+:
+$* --output-dir $~ $src_base/sourced-forward/includee.xsd 2>>/"EOE" != 0
+ $src_base/sourced-forward/includee.xsd:7:35: error: base type 'Base' not found in 'Derived' definition
+ EOE
diff --git a/xsd-tests/schema/list/anonymous/test.xsd b/xsd-tests/schema/list/anonymous/test.xsd
new file mode 100644
index 0000000..7db39ba
--- /dev/null
+++ b/xsd-tests/schema/list/anonymous/test.xsd
@@ -0,0 +1,16 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:simpleType name="IntList">
+ <xsd:list>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+ </xsd:list>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/list/any-simple-type/test.xsd b/xsd-tests/schema/list/any-simple-type/test.xsd
new file mode 100644
index 0000000..29fe95c
--- /dev/null
+++ b/xsd-tests/schema/list/any-simple-type/test.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:simpleType name="any">
+ <xsd:list itemType="xsd:anySimpleType"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/list/buildfile b/xsd-tests/schema/list/buildfile
new file mode 100644
index 0000000..5d8f7fc
--- /dev/null
+++ b/xsd-tests/schema/list/buildfile
@@ -0,0 +1,31 @@
+# file : schema/list/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+fs = test anonymous/test
+
+./: {hxx cxx}{$fs}
+
+# Make sure that the schema files are compilable.
+#
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $directory($path($>[0])) \
+ $path($<[0])
+ }}
+}
+
+# Test that the invalid schema files compilation expectedly fails.
+#
+./: testscript xsd{** -{$fs}} $xsd
+
+testscript{*}:
+{
+ test = $xsd
+ test.arguments = cxx-tree --std c++11
+}
diff --git a/xsd-tests/schema/list/test.xsd b/xsd-tests/schema/list/test.xsd
new file mode 100644
index 0000000..e16a58d
--- /dev/null
+++ b/xsd-tests/schema/list/test.xsd
@@ -0,0 +1,72 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:simpleType name="IntList">
+ <xsd:list itemType="xsd:int"/>
+ </xsd:simpleType>
+
+ <!-- local element with anonymous list inside. -->
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element name="string-list">
+ <xsd:simpleType>
+ <xsd:list itemType="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <!-- global element with anonymous list inside. -->
+
+ <xsd:element name="string-list">
+ <xsd:simpleType>
+ <xsd:list itemType="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+
+ <!-- global element and global list with conflicting names -->
+
+ <xsd:simpleType name="long-list">
+ <xsd:list itemType="xsd:long"/>
+ </xsd:simpleType>
+
+ <xsd:element name="long-list" type="test:long-list"/>
+
+
+ <!-- forward reference -->
+
+ <xsd:simpleType name="int-list">
+ <xsd:list itemType="test:int"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="int">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+
+ <!-- inheritance from list -->
+
+ <xsd:complexType name="IntComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntList">
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="IntComplexEmpty">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntList">
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/list/testscript b/xsd-tests/schema/list/testscript
new file mode 100644
index 0000000..0916be0
--- /dev/null
+++ b/xsd-tests/schema/list/testscript
@@ -0,0 +1,8 @@
+# file : schema/list/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+: invalid-definition
+:
+$* --output-dir $~ $src_base/any-simple-type/test.xsd 2>>/"EOE" != 0
+ $src_base/any-simple-type/test.xsd:9:45: error: item type definition must have variety of atomic or union where all member types must be atomic
+ EOE
diff --git a/xsd-tests/schema/no-namespace/buildfile b/xsd-tests/schema/no-namespace/buildfile
new file mode 100644
index 0000000..e407218
--- /dev/null
+++ b/xsd-tests/schema/no-namespace/buildfile
@@ -0,0 +1,22 @@
+# file : schema/no-namespace/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/no-namespace/driver.cxx b/xsd-tests/schema/no-namespace/driver.cxx
new file mode 100644
index 0000000..ef62942
--- /dev/null
+++ b/xsd-tests/schema/no-namespace/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/no-namespace/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/no-namespace/test.xsd b/xsd-tests/schema/no-namespace/test.xsd
new file mode 100644
index 0000000..b426e8a
--- /dev/null
+++ b/xsd-tests/schema/no-namespace/test.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd">
+
+
+ <xsd:complexType name="Test">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="test" type="Test"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/recursive/buildfile b/xsd-tests/schema/recursive/buildfile
new file mode 100644
index 0000000..34542c6
--- /dev/null
+++ b/xsd-tests/schema/recursive/buildfile
@@ -0,0 +1,22 @@
+# file : schema/recursive/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/recursive/driver.cxx b/xsd-tests/schema/recursive/driver.cxx
new file mode 100644
index 0000000..55c33cd
--- /dev/null
+++ b/xsd-tests/schema/recursive/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/recursive/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/recursive/test.xsd b/xsd-tests/schema/recursive/test.xsd
new file mode 100644
index 0000000..6efc7d2
--- /dev/null
+++ b/xsd-tests/schema/recursive/test.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:element name="BooleanExpression">
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:element name="literal" type="xsd:boolean"/>
+ <xsd:element ref="test:AND"/>
+ <xsd:element ref="test:OR"/>
+ <xsd:element ref="test:XOR"/>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="AND">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:BooleanExpression" maxOccurs="2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="OR">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:BooleanExpression" maxOccurs="2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="XOR">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:BooleanExpression" maxOccurs="2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/ref-type/invalid/buildfile b/xsd-tests/schema/ref-type/invalid/buildfile
new file mode 100644
index 0000000..42c7bfb
--- /dev/null
+++ b/xsd-tests/schema/ref-type/invalid/buildfile
@@ -0,0 +1,12 @@
+# file : schema/ref-type/invalid/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Test that the invalid schema files compilation expectedly fails.
+#
+./: testscript xsd{*} $xsd
+
+testscript{*}:
+{
+ test = $xsd
+ test.arguments = cxx-tree --std c++11
+}
diff --git a/xsd-tests/schema/ref-type/invalid/invalid-0.xsd b/xsd-tests/schema/ref-type/invalid/invalid-0.xsd
new file mode 100644
index 0000000..7ce82ed
--- /dev/null
+++ b/xsd-tests/schema/ref-type/invalid/invalid-0.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ xmlns:phony="http://www.codesynthesis.com/xmlns/phony"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- unresolvable namespace prefix -->
+
+ <xsd:attribute name="attribute1" type="xsd:IDREF" xse:refType="author"/>
+ <xsd:attribute name="attribute2" type="xsd:IDREF" xse:refType="t:author"/>
+
+ <!-- unresolvable namespace -->
+
+ <xsd:attribute name="attribute3" type="xsd:IDREF" xse:refType="phony:author"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/ref-type/invalid/invalid-1.xsd b/xsd-tests/schema/ref-type/invalid/invalid-1.xsd
new file mode 100644
index 0000000..d989065
--- /dev/null
+++ b/xsd-tests/schema/ref-type/invalid/invalid-1.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- unresolvable type -->
+
+ <xsd:attribute name="attribute" type="xsd:IDREF" xse:refType="test:author"/>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/ref-type/invalid/testscript b/xsd-tests/schema/ref-type/invalid/testscript
new file mode 100644
index 0000000..ce2e049
--- /dev/null
+++ b/xsd-tests/schema/ref-type/invalid/testscript
@@ -0,0 +1,16 @@
+# file : schema/ref-type/invalid/testscript
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+: unresolvable-namespace-prefix
+:
+$* --output-dir $~ $src_base/invalid-0.xsd 2>>~%EOE%d != 0
+ %\.+invalid-0.xsd:10:75: error: unable to resolve namespace ''%
+ %\.+invalid-0.xsd:11:77: error: unable to resolve namespace prefix 't' in 't:author'%
+ %\.+invalid-0.xsd:15:81: error: unable to resolve namespace 'http://www.codesynthesis.com/xmlns/phony'%
+ EOE
+
+: unresolvable-type
+:
+$* --output-dir $~ $src_base/invalid-1.xsd 2>>~%EOE%d != 0
+ %\.+invalid-1.xsd:9:79: error: unable to resolve type 'author' in namespace 'http://www.codesynthesis.com/xmlns/test'%
+ EOE
diff --git a/xsd-tests/schema/ref-type/valid/.gitignore b/xsd-tests/schema/ref-type/valid/.gitignore
new file mode 100644
index 0000000..fd203ec
--- /dev/null
+++ b/xsd-tests/schema/ref-type/valid/.gitignore
@@ -0,0 +1,6 @@
+driver-idref
+driver-idrefs
+driver-idref.?xx
+driver-idrefs.?xx
+idref.?xx
+idrefs.?xx
diff --git a/xsd-tests/schema/ref-type/valid/buildfile b/xsd-tests/schema/ref-type/valid/buildfile
new file mode 100644
index 0000000..0534fce
--- /dev/null
+++ b/xsd-tests/schema/ref-type/valid/buildfile
@@ -0,0 +1,35 @@
+# file : schema/ref-type/valid/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+for sc: idref idrefs
+{
+ dr = "driver-$sc"
+
+ ./: exe{$dr}: cxx{$dr} {hxx cxx}{$sc} $libs
+
+ cxx{$dr}: in{driver}
+ {
+ # Note: we can't use $sc$ in driver.cxx.in since it will be substituted by
+ # the latest $sc value.
+ #
+ sch = $sc
+ }
+
+ <{hxx cxx}{$sc}>: xsd{$sc} $xsd
+ {{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+ }}
+}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/ref-type/valid/driver.cxx.in b/xsd-tests/schema/ref-type/valid/driver.cxx.in
new file mode 100644
index 0000000..434aa40
--- /dev/null
+++ b/xsd-tests/schema/ref-type/valid/driver.cxx.in
@@ -0,0 +1,9 @@
+// file : schema/ref-type/valid/driver.cxx.in
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "$sch$.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/ref-type/valid/idref.xsd b/xsd-tests/schema/ref-type/valid/idref.xsd
new file mode 100644
index 0000000..49ebe40
--- /dev/null
+++ b/xsd-tests/schema/ref-type/valid/idref.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- attribute -->
+
+ <xsd:attribute name="attribute" type="xsd:IDREF" xse:refType="test:a-author"/>
+
+ <xsd:complexType name="a-author">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="recommends" type="xsd:IDREF" xse:refType="test:a-author"/>
+ </xsd:complexType>
+
+
+ <!-- element -->
+
+ <xsd:element name="element" type="xsd:IDREF" xse:refType="test:e-author"/>
+
+ <xsd:complexType name="e-author">
+ <xsd:sequence>
+ <xsd:element name="recommends" type="xsd:IDREF" xse:refType="test:e-author"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- base -->
+
+ <xsd:simpleType name="author-ref">
+ <xsd:restriction base="xsd:IDREF" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+
+
+ <!-- itemType -->
+
+ <xsd:simpleType name="author-refs">
+ <xsd:list itemType="xsd:IDREF" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/ref-type/valid/idrefs.xsd b/xsd-tests/schema/ref-type/valid/idrefs.xsd
new file mode 100644
index 0000000..b68ed03
--- /dev/null
+++ b/xsd-tests/schema/ref-type/valid/idrefs.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- attribute -->
+
+ <xsd:attribute name="attribute" type="xsd:IDREFS" xse:refType="test:a-author"/>
+
+ <xsd:complexType name="a-author">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="recommends" type="xsd:IDREFS" xse:refType="test:a-author"/>
+ </xsd:complexType>
+
+
+ <!-- element -->
+
+ <xsd:element name="element" type="xsd:IDREFS" xse:refType="test:e-author"/>
+
+ <xsd:complexType name="e-author">
+ <xsd:sequence>
+ <xsd:element name="recommends" type="xsd:IDREFS" xse:refType="test:e-author"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- base -->
+
+ <xsd:simpleType name="author-refs">
+ <xsd:restriction base="xsd:IDREFS" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+
+
+ <!-- itemType - illegal -->
+ <!--
+ <xsd:simpleType name="author-refss">
+ <xsd:list itemType="xsd:IDREFS" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+ -->
+
+</xsd:schema>
diff --git a/xsd-tests/schema/restriction/buildfile b/xsd-tests/schema/restriction/buildfile
new file mode 100644
index 0000000..c05718a
--- /dev/null
+++ b/xsd-tests/schema/restriction/buildfile
@@ -0,0 +1,22 @@
+# file : schema/restriction/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/restriction/driver.cxx b/xsd-tests/schema/restriction/driver.cxx
new file mode 100644
index 0000000..2ffeb74
--- /dev/null
+++ b/xsd-tests/schema/restriction/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/restriction/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/restriction/test.xsd b/xsd-tests/schema/restriction/test.xsd
new file mode 100644
index 0000000..331ba78
--- /dev/null
+++ b/xsd-tests/schema/restriction/test.xsd
@@ -0,0 +1,67 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Simple content. -->
+
+ <xsd:complexType name="SimpleBase">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="lang" type="xsd:language"/>
+ <xsd:attribute name="note" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="SimpleType">
+ <xsd:simpleContent>
+ <xsd:restriction base="test:SimpleBase">
+ <xsd:maxLength value="255"/>
+ <xsd:attribute name="lang">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:language">
+ <xsd:enumeration value="en"/>
+ <xsd:enumeration value="es"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <!-- Complex content. -->
+
+ <xsd:complexType name="ComplexBase">
+ <xsd:sequence>
+ <xsd:element name="lang" type="xsd:language"/>
+ <xsd:element name="note" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="ComplexType">
+ <xsd:complexContent>
+ <xsd:restriction base="test:ComplexBase">
+ <xsd:sequence>
+ <xsd:element name="lang" type="xsd:language"/>
+ <xsd:element name="note" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="AnyType">
+ <xsd:complexContent>
+ <xsd:restriction base="xsd:anyType">
+ <xsd:sequence>
+ <xsd:element name="lang" type="xsd:language"/>
+ <xsd:element name="note" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/xsd-tests/schema/union/buildfile b/xsd-tests/schema/union/buildfile
new file mode 100644
index 0000000..00d0a83
--- /dev/null
+++ b/xsd-tests/schema/union/buildfile
@@ -0,0 +1,22 @@
+# file : schema/union/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/union/driver.cxx b/xsd-tests/schema/union/driver.cxx
new file mode 100644
index 0000000..45f290f
--- /dev/null
+++ b/xsd-tests/schema/union/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/union/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/union/test.xsd b/xsd-tests/schema/union/test.xsd
new file mode 100644
index 0000000..706f6f2
--- /dev/null
+++ b/xsd-tests/schema/union/test.xsd
@@ -0,0 +1,65 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <xsd:simpleType name="IntUnion">
+ <xsd:union memberTypes="xsd:int xsd:string"/>
+ </xsd:simpleType>
+
+ <!-- local element with anonymous union inside. -->
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element name="string-union">
+ <xsd:simpleType>
+ <xsd:union memberTypes="xsd:int xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <!-- global element with anonymous union inside. -->
+
+ <xsd:element name="string-union">
+ <xsd:simpleType>
+ <xsd:union memberTypes="xsd:int xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+
+ <!-- global element and global union with conflicting names -->
+
+ <xsd:simpleType name="long-union">
+ <xsd:union memberTypes="xsd:long xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="long-union" type="test:long-union"/>
+
+
+ <!-- forward reference -->
+
+ <xsd:simpleType name="int-union">
+ <xsd:union memberTypes="test:int xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="int">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+
+ <!-- inheritance from union -->
+
+ <xsd:complexType name="IntComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntUnion">
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>