diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-08 17:23:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-08 17:23:30 +0200 |
commit | 0bce70a0e483294b83b8bf9d5468838a63405612 (patch) | |
tree | d11afb4998d6980435c15c4df6e40b1979531672 /tests/cxx/hybrid | |
parent | 6c63b913179127e09ed7d9da8920493ccceec6ce (diff) |
Add support for binary representations
xsde/cxx/hybrid/insertion-*: insertion operators generator
xsde/cxx/hybrid/extraction-*: extraction operators generator
libxsde/xsde/cxx/hybrid/cdr/: CDR support code
libxsde/xsde/cxx/hybrid/xdr/: XDR support code
tests/cxx/hybrid/binary/: new tests
examples/cxx/hybrid/binary/: new examples
documentation/cxx/hybrid/guide/: new chapter
Diffstat (limited to 'tests/cxx/hybrid')
-rw-r--r-- | tests/cxx/hybrid/binary/cdr/driver.cxx | 102 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/cdr/makefile | 97 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/cdr/output.xml | 2 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/cdr/test.xml | 93 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/cdr/test.xsd | 131 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/custom/driver.cxx | 102 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/custom/makefile | 128 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/custom/output.xml | 2 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/custom/test.xml | 93 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/custom/test.xsd | 131 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/xdr/driver.cxx | 147 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/xdr/makefile | 98 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/xdr/output.xml | 2 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/xdr/test.xml | 93 | ||||
-rw-r--r-- | tests/cxx/hybrid/binary/xdr/test.xsd | 131 | ||||
-rw-r--r-- | tests/cxx/hybrid/makefile | 8 |
16 files changed, 1360 insertions, 0 deletions
diff --git a/tests/cxx/hybrid/binary/cdr/driver.cxx b/tests/cxx/hybrid/binary/cdr/driver.cxx new file mode 100644 index 0000000..e7909cf --- /dev/null +++ b/tests/cxx/hybrid/binary/cdr/driver.cxx @@ -0,0 +1,102 @@ +// file : tests/cxx/hybrid/binary/cdr/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test CDR insertion and extraction. +// + +#include <memory> +#include <iostream> + +#include <ace/CDR_Stream.h> + +#include "test.hxx" +#include "test-pimpl.hxx" +#include "test-simpl.hxx" + +using std::cerr; +using std::endl; + +using namespace test; + +int +main (int argc, char* argv[]) +{ + /* + try + { + */ + + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + // Parse. + // + root_paggr root_p; + + xml_schema::document_pimpl doc_p ( + root_p.root_parser (), + root_p.root_namespace (), + root_p.root_name ()); + + root_p.pre (); + doc_p.parse (argv[1]); + std::auto_ptr<type> r (root_p.post ()); + + // Save to a CDR stream. + // + ACE_OutputCDR ace_ocdr; + xml_schema::ocdrstream ocdr (ace_ocdr); + ocdr << *r; + + // Load from a CDR stream. + // + ACE_InputCDR ace_icdr (ace_ocdr); + xml_schema::icdrstream icdr (ace_icdr); + std::auto_ptr<type> c (new type); + icdr >> *c; + + // Serialize. + // + root_saggr root_s; + + xml_schema::document_simpl doc_s ( + root_s.root_serializer (), + root_s.root_namespace (), + root_s.root_name ()); + + doc_s.add_prefix ("t", "test"); + + root_s.pre (*c); + doc_s.serialize (std::cout); + root_s.post (); + + /* + } + catch (const xml_schema::xdr_exception&) + { + cerr << "XDR operation filed" << endl; + return 1; + } + catch (const xml_schema::parser_exception& e) + { + cerr << argv[0] << ":" << e.line () << ":" << e.column () << ": " + << e.text () << endl; + return 1; + } + catch (const xml_schema::serializer_exception& e) + { + cerr << "error: " << e.text () << endl; + return 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[0] << ": unable to open or read/write failure" << endl; + return 1; + } + */ +} diff --git a/tests/cxx/hybrid/binary/cdr/makefile b/tests/cxx/hybrid/binary/cdr/makefile new file mode 100644 index 0000000..a557d82 --- /dev/null +++ b/tests/cxx/hybrid/binary/cdr/makefile @@ -0,0 +1,97 @@ +# file : tests/cxx/hybrid/binary/cdr/makefile +# author : Boris Kolpackov <boris@codesynthesis.com> +# copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make + +xsd := test.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,\ +$(cxx:.cxx=.o) \ +$(xsd:.xsd=.o) \ +$(xsd:.xsd=-pskel.o) \ +$(xsd:.xsd=-pimpl.o) \ +$(xsd:.xsd=-sskel.o) \ +$(xsd:.xsd=-simpl.o)) + +dep := $(obj:.o=.o.d) + +xsde.l := $(out_root)/libxsde/xsde/xsde.l +xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options + +driver := $(out_base)/driver +test := $(out_base)/.test +clean := $(out_base)/.clean + +# Build. +# +$(driver): $(obj) $(xsde.l) + +$(obj) $(dep): $(xsde.l.cpp-options) + +genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) \ + $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.cxx) \ + $(xsd:.xsd=-pimpl.hxx) $(xsd:.xsd=-pimpl.cxx) \ + $(xsd:.xsd=-sskel.hxx) $(xsd:.xsd=-sskel.cxx) \ + $(xsd:.xsd=-simpl.hxx) $(xsd:.xsd=-simpl.cxx) + +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(out_root)/xsde/xsde +$(gen): xsde := $(out_root)/xsde/xsde +$(gen): xsde_options += --generate-parser --generate-serializer \ +--generate-aggregate --generate-extraction CDR --generate-insertion CDR + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Test. +# +.PHONY: $(test) + +$(test): driver := $(driver) +$(test): $(driver) $(src_base)/test.xml $(src_base)/output.xml + $(call message,test $$1,$$1 $(src_base)/test.xml | diff -ubB $(src_base)/output.xml -,$(driver)) + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(gen): | $(out_base)/.gitignore +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + + +# How to. +# +$(call include,$(bld_root)/cxx/o-e.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsde/makefile) +$(call import,$(src_root)/libxsde/xsde/makefile) diff --git a/tests/cxx/hybrid/binary/cdr/output.xml b/tests/cxx/hybrid/binary/cdr/output.xml new file mode 100644 index 0000000..a484661 --- /dev/null +++ b/tests/cxx/hybrid/binary/cdr/output.xml @@ -0,0 +1,2 @@ +<t:root xmlns:t="test"><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><choice></choice><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><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>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><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><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ== +</base64_binary><hex_binary>6865782052696E617279</hex_binary><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>--02-11+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>
\ No newline at end of file diff --git a/tests/cxx/hybrid/binary/cdr/test.xml b/tests/cxx/hybrid/binary/cdr/test.xml new file mode 100644 index 0000000..acd75d2 --- /dev/null +++ b/tests/cxx/hybrid/binary/cdr/test.xml @@ -0,0 +1,93 @@ +<t:root xmlns:t="test"> + + <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> + + <choice/> + <choice><a>123</a></choice> + <choice><b>ab</b><b>cd</b><b>ef</b></choice> + <choice><c>12.34</c><d>false</d></choice> + + <!-- 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>-2147483648</long> + <unsigned_long>2147483647</unsigned_long> + <integer>-2147483648</integer> + <non_positive_integer>-2147483648</non_positive_integer> + <non_negative_integer>2147483647</non_negative_integer> + <positive_integer>2147483647</positive_integer> + <negative_integer>-2147483648</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/tests/cxx/hybrid/binary/cdr/test.xsd b/tests/cxx/hybrid/binary/cdr/test.xsd new file mode 100644 index 0000000..7a92c7e --- /dev/null +++ b/tests/cxx/hybrid/binary/cdr/test.xsd @@ -0,0 +1,131 @@ +<?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="choice"> + <choice> + <element name="a" type="int" minOccurs="0"/> + <element name="b" type="string" maxOccurs="unbounded"/> + <sequence> + <element name="c" type="double"/> + <element name="d" type="boolean"/> + </sequence> + </choice> + </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"/> + <element name="choice" type="t:choice" 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"/> + </sequence> + </complexType> + + <element name="root" type="t:type"/> + +</schema> diff --git a/tests/cxx/hybrid/binary/custom/driver.cxx b/tests/cxx/hybrid/binary/custom/driver.cxx new file mode 100644 index 0000000..400551a --- /dev/null +++ b/tests/cxx/hybrid/binary/custom/driver.cxx @@ -0,0 +1,102 @@ +// file : tests/cxx/hybrid/binary/custom/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test RAW insertion and extraction. +// + +#include <memory> +#include <iostream> + +#include "orawstream.hxx" +#include "irawstream.hxx" + +#include "test.hxx" +#include "test-pimpl.hxx" +#include "test-simpl.hxx" + +using std::cerr; +using std::endl; + +using namespace test; + +int +main (int argc, char* argv[]) +{ + /* + try + { + */ + + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + // Parse. + // + root_paggr root_p; + + xml_schema::document_pimpl doc_p ( + root_p.root_parser (), + root_p.root_namespace (), + root_p.root_name ()); + + root_p.pre (); + doc_p.parse (argv[1]); + std::auto_ptr<type> r (root_p.post ()); + + // Save the object model to a RAW stream. + // + xml_schema::buffer buf; + orawstream oraw (buf); + oraw << *r; + + // Load the object model from a RAW stream. + // + irawstream iraw (buf); + std::auto_ptr<type> c (new type); + iraw >> *c; + + // Serialize. + // + root_saggr root_s; + + xml_schema::document_simpl doc_s ( + root_s.root_serializer (), + root_s.root_namespace (), + root_s.root_name ()); + + doc_s.add_prefix ("t", "test"); + + root_s.pre (*c); + doc_s.serialize (std::cout); + root_s.post (); + + /* + } + catch (const xml_schema::xdr_exception&) + { + cerr << "XDR operation filed" << endl; + return 1; + } + catch (const xml_schema::parser_exception& e) + { + cerr << argv[0] << ":" << e.line () << ":" << e.column () << ": " + << e.text () << endl; + return 1; + } + catch (const xml_schema::serializer_exception& e) + { + cerr << "error: " << e.text () << endl; + return 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[0] << ": unable to open or read/write failure" << endl; + return 1; + } + */ +} diff --git a/tests/cxx/hybrid/binary/custom/makefile b/tests/cxx/hybrid/binary/custom/makefile new file mode 100644 index 0000000..50fe420 --- /dev/null +++ b/tests/cxx/hybrid/binary/custom/makefile @@ -0,0 +1,128 @@ +# file : tests/cxx/hybrid/binary/custom/makefile +# author : Boris Kolpackov <boris@codesynthesis.com> +# copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make + +xsd := test.xsd +cxx := driver.cxx exceptions.cxx orawstream.cxx irawstream.cxx + +obj := $(addprefix $(out_base)/,\ +$(cxx:.cxx=.o) \ +$(xsd:.xsd=.o) \ +$(xsd:.xsd=-pskel.o) \ +$(xsd:.xsd=-pimpl.o) \ +$(xsd:.xsd=-sskel.o) \ +$(xsd:.xsd=-simpl.o)) + +dep := $(obj:.o=.o.d) + +xsde.l := $(out_root)/libxsde/xsde/xsde.l +xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options + +driver := $(out_base)/driver +dist := $(out_base)/.dist +dist-win := $(out_base)/.dist-win +clean := $(out_base)/.clean + +# Build. +# +$(driver): $(obj) $(xsde.l) + +$(obj) $(dep): $(xsde.l.cpp-options) + +genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) \ + $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.cxx) \ + $(xsd:.xsd=-pimpl.hxx) $(xsd:.xsd=-pimpl.cxx) \ + $(xsd:.xsd=-sskel.hxx) $(xsd:.xsd=-sskel.cxx) \ + $(xsd:.xsd=-simpl.hxx) $(xsd:.xsd=-simpl.cxx) + +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(out_root)/xsde/xsde +$(gen): xsde := $(out_root)/xsde/xsde +$(gen): xsde_options += --generate-parser --generate-serializer \ +--generate-aggregate --extern-xml-schema xml-schema.xsd \ +--generate-insertion orawstream --hxx-prologue '\\\#include "orawstream.hxx"' \ +--generate-extraction irawstream --hxx-prologue '\\\#include "irawstream.hxx"' + +# Header files for XML Schema namespace. +# +$(out_base)/xml-schema%hxx \ +$(out_base)/xml-schema-pskel%hxx \ +$(out_base)/xml-schema-sskel%hxx: $(out_root)/xsde/xsde + $(call message,xsde $(src_base)/xml-schema.xsd,\ +$(out_root)/xsde/xsde cxx-hybrid --output-dir $(out_base) \ +--generate-xml-schema --generate-parser --generate-serializer xml-schema.xsd) + +genf += xml-schema.hxx xml-schema-pskel.hxx xml-schema-sskel.hxx + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Dist. +# +dist-common := $(out_base)/.dist-common + +.PHONY: $(dist) $(dist-win) $(dist-common) + +$(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) + +$(dist-common): + $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) + $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd) + $(call install-data,$(src_base)/library.xml,$(dist_prefix)/$(path)/library.xml) + +$(dist): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) + +$(dist-win): $(dist-common) + $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) + $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + $(call message,rm $$1,rm -f $$1,$(out_base)/xml-schema.hxx) + $(call message,rm $$1,rm -f $$1,$(out_base)/xml-schema-pskel.hxx) + $(call message,rm $$1,rm -f $$1,$(out_base)/xml-schema-sskel.hxx) + + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(gen): | $(out_base)/.gitignore +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + + +# How to. +# +$(call include,$(bld_root)/cxx/o-e.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(bld_root)/install.make) +$(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsde/makefile) +$(call import,$(src_root)/libxsde/xsde/makefile) diff --git a/tests/cxx/hybrid/binary/custom/output.xml b/tests/cxx/hybrid/binary/custom/output.xml new file mode 100644 index 0000000..a484661 --- /dev/null +++ b/tests/cxx/hybrid/binary/custom/output.xml @@ -0,0 +1,2 @@ +<t:root xmlns:t="test"><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><choice></choice><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><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>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><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><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ== +</base64_binary><hex_binary>6865782052696E617279</hex_binary><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>--02-11+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>
\ No newline at end of file diff --git a/tests/cxx/hybrid/binary/custom/test.xml b/tests/cxx/hybrid/binary/custom/test.xml new file mode 100644 index 0000000..acd75d2 --- /dev/null +++ b/tests/cxx/hybrid/binary/custom/test.xml @@ -0,0 +1,93 @@ +<t:root xmlns:t="test"> + + <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> + + <choice/> + <choice><a>123</a></choice> + <choice><b>ab</b><b>cd</b><b>ef</b></choice> + <choice><c>12.34</c><d>false</d></choice> + + <!-- 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>-2147483648</long> + <unsigned_long>2147483647</unsigned_long> + <integer>-2147483648</integer> + <non_positive_integer>-2147483648</non_positive_integer> + <non_negative_integer>2147483647</non_negative_integer> + <positive_integer>2147483647</positive_integer> + <negative_integer>-2147483648</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/tests/cxx/hybrid/binary/custom/test.xsd b/tests/cxx/hybrid/binary/custom/test.xsd new file mode 100644 index 0000000..7a92c7e --- /dev/null +++ b/tests/cxx/hybrid/binary/custom/test.xsd @@ -0,0 +1,131 @@ +<?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="choice"> + <choice> + <element name="a" type="int" minOccurs="0"/> + <element name="b" type="string" maxOccurs="unbounded"/> + <sequence> + <element name="c" type="double"/> + <element name="d" type="boolean"/> + </sequence> + </choice> + </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"/> + <element name="choice" type="t:choice" 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"/> + </sequence> + </complexType> + + <element name="root" type="t:type"/> + +</schema> diff --git a/tests/cxx/hybrid/binary/xdr/driver.cxx b/tests/cxx/hybrid/binary/xdr/driver.cxx new file mode 100644 index 0000000..2f87dd9 --- /dev/null +++ b/tests/cxx/hybrid/binary/xdr/driver.cxx @@ -0,0 +1,147 @@ +// file : tests/cxx/hybrid/binary/xdr/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test XDR insertion and extraction. +// + +#include <stddef.h> // size_t +#include <string.h> // memcpy +#include <rpc/xdr.h> + +#include <memory> +#include <iostream> + +#include "test.hxx" +#include "test-pimpl.hxx" +#include "test-simpl.hxx" + +using std::cerr; +using std::endl; + +extern "C" int +overflow (char* p, char* buf, int n) +{ + xml_schema::buffer* dst (reinterpret_cast<xml_schema::buffer*> (p)); + + size_t size (dst->size ()); + dst->size (size + n); + memcpy (dst->data () + size, buf, n); + + return n; +} + +struct underflow_info +{ + xml_schema::buffer* buf; + std::size_t pos; +}; + +extern "C" int +underflow (char* p, char* buf, int n) +{ + underflow_info* ui (reinterpret_cast<underflow_info*> (p)); + + size_t size (ui->buf->size () - ui->pos); + n = size > n ? n : size; + + memcpy (buf, ui->buf->data () + ui->pos, n); + ui->pos += n; + + return n; +} + +using namespace test; + +int +main (int argc, char* argv[]) +{ + /* + try + { + */ + + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + // Parse. + // + root_paggr root_p; + + xml_schema::document_pimpl doc_p ( + root_p.root_parser (), + root_p.root_namespace (), + root_p.root_name ()); + + root_p.pre (); + doc_p.parse (argv[1]); + std::auto_ptr<type> r (root_p.post ()); + + // 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; + xml_schema::oxdrstream 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); + xml_schema::ixdrstream ixdr (xdr); + std::auto_ptr<type> c (new type); + ixdr >> *c; + xdr_destroy (&xdr); + + // Serialize. + // + root_saggr root_s; + + xml_schema::document_simpl doc_s ( + root_s.root_serializer (), + root_s.root_namespace (), + root_s.root_name ()); + + doc_s.add_prefix ("t", "test"); + + root_s.pre (*c); + doc_s.serialize (std::cout); + root_s.post (); + + /* + } + catch (const xml_schema::xdr_exception&) + { + cerr << "XDR operation filed" << endl; + return 1; + } + catch (const xml_schema::parser_exception& e) + { + cerr << argv[0] << ":" << e.line () << ":" << e.column () << ": " + << e.text () << endl; + return 1; + } + catch (const xml_schema::serializer_exception& e) + { + cerr << "error: " << e.text () << endl; + return 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[0] << ": unable to open or read/write failure" << endl; + return 1; + } + */ +} diff --git a/tests/cxx/hybrid/binary/xdr/makefile b/tests/cxx/hybrid/binary/xdr/makefile new file mode 100644 index 0000000..d15723f --- /dev/null +++ b/tests/cxx/hybrid/binary/xdr/makefile @@ -0,0 +1,98 @@ +# file : tests/cxx/hybrid/binary/xdr/makefile +# author : Boris Kolpackov <boris@codesynthesis.com> +# copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../../../../build/bootstrap.make + +xsd := test.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,\ +$(cxx:.cxx=.o) \ +$(xsd:.xsd=.o) \ +$(xsd:.xsd=-pskel.o) \ +$(xsd:.xsd=-pimpl.o) \ +$(xsd:.xsd=-sskel.o) \ +$(xsd:.xsd=-simpl.o)) + +dep := $(obj:.o=.o.d) + +xsde.l := $(out_root)/libxsde/xsde/xsde.l +xsde.l.cpp-options := $(out_root)/libxsde/xsde/xsde.l.cpp-options + +driver := $(out_base)/driver +test := $(out_base)/.test +clean := $(out_base)/.clean + + +# Build. +# +$(driver): $(obj) $(xsde.l) + +$(obj) $(dep): $(xsde.l.cpp-options) + +genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.cxx) \ + $(xsd:.xsd=-pskel.hxx) $(xsd:.xsd=-pskel.cxx) \ + $(xsd:.xsd=-pimpl.hxx) $(xsd:.xsd=-pimpl.cxx) \ + $(xsd:.xsd=-sskel.hxx) $(xsd:.xsd=-sskel.cxx) \ + $(xsd:.xsd=-simpl.hxx) $(xsd:.xsd=-simpl.cxx) + +gen := $(addprefix $(out_base)/,$(genf)) + +$(gen): $(out_root)/xsde/xsde +$(gen): xsde := $(out_root)/xsde/xsde +$(gen): xsde_options += --generate-parser --generate-serializer \ +--generate-aggregate --generate-extraction XDR --generate-insertion XDR + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Test. +# +.PHONY: $(test) + +$(test): driver := $(driver) +$(test): $(driver) $(src_base)/test.xml $(src_base)/output.xml + $(call message,test $$1,$$1 $(src_base)/test.xml | diff -ubB $(src_base)/output.xml -,$(driver)) + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(gen): | $(out_base)/.gitignore +$(driver): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := driver $(genf) +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + + +# How to. +# +$(call include,$(bld_root)/cxx/o-e.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/cxx-d.make) +$(call include,$(scf_root)/xsde/hybrid/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsde/makefile) +$(call import,$(src_root)/libxsde/xsde/makefile) diff --git a/tests/cxx/hybrid/binary/xdr/output.xml b/tests/cxx/hybrid/binary/xdr/output.xml new file mode 100644 index 0000000..a484661 --- /dev/null +++ b/tests/cxx/hybrid/binary/xdr/output.xml @@ -0,0 +1,2 @@ +<t:root xmlns:t="test"><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><choice></choice><choice><a>123</a></choice><choice><b>ab</b><b>cd</b><b>ef</b></choice><choice><c>12.34</c><d>false</d></choice><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>-2147483648</long><unsigned_long>2147483647</unsigned_long><integer>-2147483648</integer><non_positive_integer>-2147483648</non_positive_integer><non_negative_integer>2147483647</non_negative_integer><positive_integer>2147483647</positive_integer><negative_integer>-2147483648</negative_integer><boolean>true</boolean><float>1234.12</float><double>12345678.1234568</double><decimal>1234567812345678</decimal><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><qname>xsi:schemaLocation</qname><id>elements1</id><id>elements2</id><id_ref>elements1</id_ref><id_refs>elements1 elements2</id_refs><any_uri>http://www.codesynthesis.com</any_uri><base64_binary>YmFzZTY0IGJpbmFyeQ== +</base64_binary><hex_binary>6865782052696E617279</hex_binary><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>--02-11+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>
\ No newline at end of file diff --git a/tests/cxx/hybrid/binary/xdr/test.xml b/tests/cxx/hybrid/binary/xdr/test.xml new file mode 100644 index 0000000..acd75d2 --- /dev/null +++ b/tests/cxx/hybrid/binary/xdr/test.xml @@ -0,0 +1,93 @@ +<t:root xmlns:t="test"> + + <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> + + <choice/> + <choice><a>123</a></choice> + <choice><b>ab</b><b>cd</b><b>ef</b></choice> + <choice><c>12.34</c><d>false</d></choice> + + <!-- 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>-2147483648</long> + <unsigned_long>2147483647</unsigned_long> + <integer>-2147483648</integer> + <non_positive_integer>-2147483648</non_positive_integer> + <non_negative_integer>2147483647</non_negative_integer> + <positive_integer>2147483647</positive_integer> + <negative_integer>-2147483648</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/tests/cxx/hybrid/binary/xdr/test.xsd b/tests/cxx/hybrid/binary/xdr/test.xsd new file mode 100644 index 0000000..7a92c7e --- /dev/null +++ b/tests/cxx/hybrid/binary/xdr/test.xsd @@ -0,0 +1,131 @@ +<?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="choice"> + <choice> + <element name="a" type="int" minOccurs="0"/> + <element name="b" type="string" maxOccurs="unbounded"/> + <sequence> + <element name="c" type="double"/> + <element name="d" type="boolean"/> + </sequence> + </choice> + </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"/> + <element name="choice" type="t:choice" 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"/> + </sequence> + </complexType> + + <element name="root" type="t:type"/> + +</schema> diff --git a/tests/cxx/hybrid/makefile b/tests/cxx/hybrid/makefile index 3351241..84fed4c 100644 --- a/tests/cxx/hybrid/makefile +++ b/tests/cxx/hybrid/makefile @@ -10,6 +10,14 @@ tests := sequences ifeq ($(xsde_iostream),y) tests += built-in list test-template union +ifeq ($(xsde_cdr),y) +tests += binary/cdr +endif + +ifeq ($(xsde_xdr),y) +tests += binary/xdr +endif + ifeq ($(xsde_parser_validation),y) tests += choice endif |