From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- examples/cxx/tree/README | 70 ++++++++ examples/cxx/tree/binary/README | 16 ++ examples/cxx/tree/binary/boost/README | 49 +++++ .../tree/binary/boost/boost-archive-extraction.hxx | 188 +++++++++++++++++++ .../tree/binary/boost/boost-archive-insertion.hxx | 177 ++++++++++++++++++ examples/cxx/tree/binary/boost/driver.cxx | 73 ++++++++ .../cxx/tree/binary/boost/library-prologue.hxx | 9 + examples/cxx/tree/binary/boost/library.xml | 53 ++++++ examples/cxx/tree/binary/boost/library.xsd | 76 ++++++++ examples/cxx/tree/binary/boost/makefile | 79 ++++++++ examples/cxx/tree/binary/cdr/README | 36 ++++ examples/cxx/tree/binary/cdr/driver.cxx | 88 +++++++++ examples/cxx/tree/binary/cdr/library.xml | 53 ++++++ examples/cxx/tree/binary/cdr/library.xsd | 76 ++++++++ examples/cxx/tree/binary/cdr/makefile | 78 ++++++++ examples/cxx/tree/binary/makefile | 30 ++++ examples/cxx/tree/binary/xdr/README | 34 ++++ examples/cxx/tree/binary/xdr/driver.cxx | 149 +++++++++++++++ examples/cxx/tree/binary/xdr/library.xml | 53 ++++++ examples/cxx/tree/binary/xdr/library.xsd | 76 ++++++++ examples/cxx/tree/binary/xdr/makefile | 78 ++++++++ examples/cxx/tree/caching/README | 29 +++ examples/cxx/tree/caching/driver.cxx | 179 ++++++++++++++++++ examples/cxx/tree/caching/library.xml | 53 ++++++ examples/cxx/tree/caching/library.xsd | 73 ++++++++ examples/cxx/tree/caching/makefile | 71 ++++++++ examples/cxx/tree/custom/README | 37 ++++ examples/cxx/tree/custom/calendar/README | 47 +++++ examples/cxx/tree/custom/calendar/calendar.xml | 23 +++ examples/cxx/tree/custom/calendar/calendar.xsd | 32 ++++ examples/cxx/tree/custom/calendar/driver.cxx | 40 +++++ examples/cxx/tree/custom/calendar/makefile | 90 ++++++++++ .../cxx/tree/custom/calendar/xml-schema-custom.cxx | 57 ++++++ .../cxx/tree/custom/calendar/xml-schema-custom.hxx | 34 ++++ examples/cxx/tree/custom/comments/README | 57 ++++++ examples/cxx/tree/custom/comments/dom-parse.cxx | 118 ++++++++++++ examples/cxx/tree/custom/comments/dom-parse.hxx | 23 +++ examples/cxx/tree/custom/comments/driver.cxx | 91 ++++++++++ examples/cxx/tree/custom/comments/makefile | 84 +++++++++ examples/cxx/tree/custom/comments/people.xml | 21 +++ examples/cxx/tree/custom/comments/people.xsd | 30 ++++ .../cxx/tree/custom/comments/xml-schema-custom.cxx | 118 ++++++++++++ .../cxx/tree/custom/comments/xml-schema-custom.hxx | 58 ++++++ examples/cxx/tree/custom/contacts/README | 40 +++++ .../cxx/tree/custom/contacts/contacts-custom.cxx | 51 ++++++ .../cxx/tree/custom/contacts/contacts-custom.hxx | 44 +++++ examples/cxx/tree/custom/contacts/contacts.xml | 21 +++ examples/cxx/tree/custom/contacts/contacts.xsd | 32 ++++ examples/cxx/tree/custom/contacts/driver.cxx | 39 ++++ examples/cxx/tree/custom/contacts/makefile | 77 ++++++++ examples/cxx/tree/custom/double/README | 62 +++++++ examples/cxx/tree/custom/double/double-custom.cxx | 97 ++++++++++ examples/cxx/tree/custom/double/double-custom.hxx | 68 +++++++ examples/cxx/tree/custom/double/driver.cxx | 32 ++++ examples/cxx/tree/custom/double/makefile | 79 ++++++++ examples/cxx/tree/custom/double/order.xsd | 26 +++ examples/cxx/tree/custom/makefile | 22 +++ examples/cxx/tree/custom/taxonomy/README | 50 ++++++ examples/cxx/tree/custom/taxonomy/driver.cxx | 39 ++++ examples/cxx/tree/custom/taxonomy/makefile | 82 +++++++++ .../cxx/tree/custom/taxonomy/people-custom-fwd.hxx | 20 +++ .../cxx/tree/custom/taxonomy/people-custom.cxx | 180 +++++++++++++++++++ .../cxx/tree/custom/taxonomy/people-custom.hxx | 103 +++++++++++ examples/cxx/tree/custom/taxonomy/people.xml | 27 +++ examples/cxx/tree/custom/taxonomy/people.xsd | 45 +++++ examples/cxx/tree/custom/wildcard/README | 45 +++++ examples/cxx/tree/custom/wildcard/driver.cxx | 48 +++++ examples/cxx/tree/custom/wildcard/makefile | 79 ++++++++ .../cxx/tree/custom/wildcard/wildcard-custom.cxx | 85 +++++++++ .../cxx/tree/custom/wildcard/wildcard-custom.hxx | 67 +++++++ examples/cxx/tree/custom/wildcard/wildcard.xml | 15 ++ examples/cxx/tree/custom/wildcard/wildcard.xsd | 26 +++ examples/cxx/tree/dbxml/README | 45 +++++ examples/cxx/tree/dbxml/driver.cxx | 175 ++++++++++++++++++ examples/cxx/tree/dbxml/library.xsd | 75 ++++++++ examples/cxx/tree/dbxml/makefile | 76 ++++++++ examples/cxx/tree/hello/README | 26 +++ examples/cxx/tree/hello/driver.cxx | 37 ++++ examples/cxx/tree/hello/hello.xml | 20 +++ examples/cxx/tree/hello/hello.xsd | 53 ++++++ examples/cxx/tree/hello/makefile | 71 ++++++++ examples/cxx/tree/library/README | 32 ++++ examples/cxx/tree/library/driver.cxx | 131 ++++++++++++++ examples/cxx/tree/library/library.xml | 53 ++++++ examples/cxx/tree/library/library.xsd | 73 ++++++++ examples/cxx/tree/library/makefile | 73 ++++++++ examples/cxx/tree/makefile | 27 +++ examples/cxx/tree/messaging/README | 58 ++++++ examples/cxx/tree/messaging/balance.xml | 17 ++ examples/cxx/tree/messaging/deposit.xml | 18 ++ examples/cxx/tree/messaging/dom-parse.cxx | 118 ++++++++++++ examples/cxx/tree/messaging/dom-parse.hxx | 23 +++ examples/cxx/tree/messaging/dom-serialize.cxx | 89 +++++++++ examples/cxx/tree/messaging/dom-serialize.hxx | 21 +++ examples/cxx/tree/messaging/driver.cxx | 145 +++++++++++++++ examples/cxx/tree/messaging/makefile | 72 ++++++++ examples/cxx/tree/messaging/protocol.xsd | 54 ++++++ examples/cxx/tree/messaging/withdraw.xml | 18 ++ examples/cxx/tree/mixed/README | 38 ++++ examples/cxx/tree/mixed/driver.cxx | 121 +++++++++++++ examples/cxx/tree/mixed/makefile | 73 ++++++++ examples/cxx/tree/mixed/text.xml | 18 ++ examples/cxx/tree/mixed/text.xsd | 29 +++ examples/cxx/tree/multiroot/README | 45 +++++ examples/cxx/tree/multiroot/balance.xml | 17 ++ examples/cxx/tree/multiroot/deposit.xml | 18 ++ examples/cxx/tree/multiroot/dom-parse.cxx | 118 ++++++++++++ examples/cxx/tree/multiroot/dom-parse.hxx | 23 +++ examples/cxx/tree/multiroot/driver.cxx | 125 +++++++++++++ examples/cxx/tree/multiroot/makefile | 71 ++++++++ examples/cxx/tree/multiroot/protocol.xsd | 51 ++++++ examples/cxx/tree/multiroot/withdraw.xml | 18 ++ examples/cxx/tree/performance/README | 60 +++++++ examples/cxx/tree/performance/driver.cxx | 91 ++++++++++ examples/cxx/tree/performance/gen.cxx | 76 ++++++++ examples/cxx/tree/performance/makefile | 72 ++++++++ examples/cxx/tree/performance/parsing.cxx | 200 +++++++++++++++++++++ examples/cxx/tree/performance/serialization.cxx | 151 ++++++++++++++++ examples/cxx/tree/performance/test-500k.xml | 1 + examples/cxx/tree/performance/test-50k.xml | 1 + examples/cxx/tree/performance/test-5k.xml | 1 + examples/cxx/tree/performance/test.xsd | 50 ++++++ examples/cxx/tree/performance/time.cxx | 47 +++++ examples/cxx/tree/performance/time.hxx | 111 ++++++++++++ examples/cxx/tree/polymorphism/README | 28 +++ examples/cxx/tree/polymorphism/driver.cxx | 60 +++++++ examples/cxx/tree/polymorphism/makefile | 72 ++++++++ examples/cxx/tree/polymorphism/supermen.xml | 26 +++ examples/cxx/tree/polymorphism/supermen.xsd | 49 +++++ examples/cxx/tree/streaming/README | 22 +++ examples/cxx/tree/streaming/driver.cxx | 65 +++++++ examples/cxx/tree/streaming/makefile | 74 ++++++++ examples/cxx/tree/streaming/records.xsd | 37 ++++ examples/cxx/tree/wildcard/README | 34 ++++ examples/cxx/tree/wildcard/driver.cxx | 160 +++++++++++++++++ examples/cxx/tree/wildcard/email.xml | 32 ++++ examples/cxx/tree/wildcard/email.xsd | 51 ++++++ examples/cxx/tree/wildcard/makefile | 72 ++++++++ examples/cxx/tree/xpath/README | 47 +++++ examples/cxx/tree/xpath/dom-parse.cxx | 113 ++++++++++++ examples/cxx/tree/xpath/dom-parse.hxx | 26 +++ examples/cxx/tree/xpath/driver-2.cxx | 139 ++++++++++++++ examples/cxx/tree/xpath/driver.cxx | 137 ++++++++++++++ examples/cxx/tree/xpath/makefile | 71 ++++++++ examples/cxx/tree/xpath/people.xml | 29 +++ examples/cxx/tree/xpath/people.xsd | 39 ++++ 146 files changed, 9116 insertions(+) create mode 100644 examples/cxx/tree/README create mode 100644 examples/cxx/tree/binary/README create mode 100644 examples/cxx/tree/binary/boost/README create mode 100644 examples/cxx/tree/binary/boost/boost-archive-extraction.hxx create mode 100644 examples/cxx/tree/binary/boost/boost-archive-insertion.hxx create mode 100644 examples/cxx/tree/binary/boost/driver.cxx create mode 100644 examples/cxx/tree/binary/boost/library-prologue.hxx create mode 100644 examples/cxx/tree/binary/boost/library.xml create mode 100644 examples/cxx/tree/binary/boost/library.xsd create mode 100644 examples/cxx/tree/binary/boost/makefile create mode 100644 examples/cxx/tree/binary/cdr/README create mode 100644 examples/cxx/tree/binary/cdr/driver.cxx create mode 100644 examples/cxx/tree/binary/cdr/library.xml create mode 100644 examples/cxx/tree/binary/cdr/library.xsd create mode 100644 examples/cxx/tree/binary/cdr/makefile create mode 100644 examples/cxx/tree/binary/makefile create mode 100644 examples/cxx/tree/binary/xdr/README create mode 100644 examples/cxx/tree/binary/xdr/driver.cxx create mode 100644 examples/cxx/tree/binary/xdr/library.xml create mode 100644 examples/cxx/tree/binary/xdr/library.xsd create mode 100644 examples/cxx/tree/binary/xdr/makefile create mode 100644 examples/cxx/tree/caching/README create mode 100644 examples/cxx/tree/caching/driver.cxx create mode 100644 examples/cxx/tree/caching/library.xml create mode 100644 examples/cxx/tree/caching/library.xsd create mode 100644 examples/cxx/tree/caching/makefile create mode 100644 examples/cxx/tree/custom/README create mode 100644 examples/cxx/tree/custom/calendar/README create mode 100644 examples/cxx/tree/custom/calendar/calendar.xml create mode 100644 examples/cxx/tree/custom/calendar/calendar.xsd create mode 100644 examples/cxx/tree/custom/calendar/driver.cxx create mode 100644 examples/cxx/tree/custom/calendar/makefile create mode 100644 examples/cxx/tree/custom/calendar/xml-schema-custom.cxx create mode 100644 examples/cxx/tree/custom/calendar/xml-schema-custom.hxx create mode 100644 examples/cxx/tree/custom/comments/README create mode 100644 examples/cxx/tree/custom/comments/dom-parse.cxx create mode 100644 examples/cxx/tree/custom/comments/dom-parse.hxx create mode 100644 examples/cxx/tree/custom/comments/driver.cxx create mode 100644 examples/cxx/tree/custom/comments/makefile create mode 100644 examples/cxx/tree/custom/comments/people.xml create mode 100644 examples/cxx/tree/custom/comments/people.xsd create mode 100644 examples/cxx/tree/custom/comments/xml-schema-custom.cxx create mode 100644 examples/cxx/tree/custom/comments/xml-schema-custom.hxx create mode 100644 examples/cxx/tree/custom/contacts/README create mode 100644 examples/cxx/tree/custom/contacts/contacts-custom.cxx create mode 100644 examples/cxx/tree/custom/contacts/contacts-custom.hxx create mode 100644 examples/cxx/tree/custom/contacts/contacts.xml create mode 100644 examples/cxx/tree/custom/contacts/contacts.xsd create mode 100644 examples/cxx/tree/custom/contacts/driver.cxx create mode 100644 examples/cxx/tree/custom/contacts/makefile create mode 100644 examples/cxx/tree/custom/double/README create mode 100644 examples/cxx/tree/custom/double/double-custom.cxx create mode 100644 examples/cxx/tree/custom/double/double-custom.hxx create mode 100644 examples/cxx/tree/custom/double/driver.cxx create mode 100644 examples/cxx/tree/custom/double/makefile create mode 100644 examples/cxx/tree/custom/double/order.xsd create mode 100644 examples/cxx/tree/custom/makefile create mode 100644 examples/cxx/tree/custom/taxonomy/README create mode 100644 examples/cxx/tree/custom/taxonomy/driver.cxx create mode 100644 examples/cxx/tree/custom/taxonomy/makefile create mode 100644 examples/cxx/tree/custom/taxonomy/people-custom-fwd.hxx create mode 100644 examples/cxx/tree/custom/taxonomy/people-custom.cxx create mode 100644 examples/cxx/tree/custom/taxonomy/people-custom.hxx create mode 100644 examples/cxx/tree/custom/taxonomy/people.xml create mode 100644 examples/cxx/tree/custom/taxonomy/people.xsd create mode 100644 examples/cxx/tree/custom/wildcard/README create mode 100644 examples/cxx/tree/custom/wildcard/driver.cxx create mode 100644 examples/cxx/tree/custom/wildcard/makefile create mode 100644 examples/cxx/tree/custom/wildcard/wildcard-custom.cxx create mode 100644 examples/cxx/tree/custom/wildcard/wildcard-custom.hxx create mode 100644 examples/cxx/tree/custom/wildcard/wildcard.xml create mode 100644 examples/cxx/tree/custom/wildcard/wildcard.xsd create mode 100644 examples/cxx/tree/dbxml/README create mode 100644 examples/cxx/tree/dbxml/driver.cxx create mode 100644 examples/cxx/tree/dbxml/library.xsd create mode 100644 examples/cxx/tree/dbxml/makefile create mode 100644 examples/cxx/tree/hello/README create mode 100644 examples/cxx/tree/hello/driver.cxx create mode 100644 examples/cxx/tree/hello/hello.xml create mode 100644 examples/cxx/tree/hello/hello.xsd create mode 100644 examples/cxx/tree/hello/makefile create mode 100644 examples/cxx/tree/library/README create mode 100644 examples/cxx/tree/library/driver.cxx create mode 100644 examples/cxx/tree/library/library.xml create mode 100644 examples/cxx/tree/library/library.xsd create mode 100644 examples/cxx/tree/library/makefile create mode 100644 examples/cxx/tree/makefile create mode 100644 examples/cxx/tree/messaging/README create mode 100644 examples/cxx/tree/messaging/balance.xml create mode 100644 examples/cxx/tree/messaging/deposit.xml create mode 100644 examples/cxx/tree/messaging/dom-parse.cxx create mode 100644 examples/cxx/tree/messaging/dom-parse.hxx create mode 100644 examples/cxx/tree/messaging/dom-serialize.cxx create mode 100644 examples/cxx/tree/messaging/dom-serialize.hxx create mode 100644 examples/cxx/tree/messaging/driver.cxx create mode 100644 examples/cxx/tree/messaging/makefile create mode 100644 examples/cxx/tree/messaging/protocol.xsd create mode 100644 examples/cxx/tree/messaging/withdraw.xml create mode 100644 examples/cxx/tree/mixed/README create mode 100644 examples/cxx/tree/mixed/driver.cxx create mode 100644 examples/cxx/tree/mixed/makefile create mode 100644 examples/cxx/tree/mixed/text.xml create mode 100644 examples/cxx/tree/mixed/text.xsd create mode 100644 examples/cxx/tree/multiroot/README create mode 100644 examples/cxx/tree/multiroot/balance.xml create mode 100644 examples/cxx/tree/multiroot/deposit.xml create mode 100644 examples/cxx/tree/multiroot/dom-parse.cxx create mode 100644 examples/cxx/tree/multiroot/dom-parse.hxx create mode 100644 examples/cxx/tree/multiroot/driver.cxx create mode 100644 examples/cxx/tree/multiroot/makefile create mode 100644 examples/cxx/tree/multiroot/protocol.xsd create mode 100644 examples/cxx/tree/multiroot/withdraw.xml create mode 100644 examples/cxx/tree/performance/README create mode 100644 examples/cxx/tree/performance/driver.cxx create mode 100644 examples/cxx/tree/performance/gen.cxx create mode 100644 examples/cxx/tree/performance/makefile create mode 100644 examples/cxx/tree/performance/parsing.cxx create mode 100644 examples/cxx/tree/performance/serialization.cxx create mode 100644 examples/cxx/tree/performance/test-500k.xml create mode 100644 examples/cxx/tree/performance/test-50k.xml create mode 100644 examples/cxx/tree/performance/test-5k.xml create mode 100644 examples/cxx/tree/performance/test.xsd create mode 100644 examples/cxx/tree/performance/time.cxx create mode 100644 examples/cxx/tree/performance/time.hxx create mode 100644 examples/cxx/tree/polymorphism/README create mode 100644 examples/cxx/tree/polymorphism/driver.cxx create mode 100644 examples/cxx/tree/polymorphism/makefile create mode 100644 examples/cxx/tree/polymorphism/supermen.xml create mode 100644 examples/cxx/tree/polymorphism/supermen.xsd create mode 100644 examples/cxx/tree/streaming/README create mode 100644 examples/cxx/tree/streaming/driver.cxx create mode 100644 examples/cxx/tree/streaming/makefile create mode 100644 examples/cxx/tree/streaming/records.xsd create mode 100644 examples/cxx/tree/wildcard/README create mode 100644 examples/cxx/tree/wildcard/driver.cxx create mode 100644 examples/cxx/tree/wildcard/email.xml create mode 100644 examples/cxx/tree/wildcard/email.xsd create mode 100644 examples/cxx/tree/wildcard/makefile create mode 100644 examples/cxx/tree/xpath/README create mode 100644 examples/cxx/tree/xpath/dom-parse.cxx create mode 100644 examples/cxx/tree/xpath/dom-parse.hxx create mode 100644 examples/cxx/tree/xpath/driver-2.cxx create mode 100644 examples/cxx/tree/xpath/driver.cxx create mode 100644 examples/cxx/tree/xpath/makefile create mode 100644 examples/cxx/tree/xpath/people.xml create mode 100644 examples/cxx/tree/xpath/people.xsd (limited to 'examples/cxx/tree') diff --git a/examples/cxx/tree/README b/examples/cxx/tree/README new file mode 100644 index 0000000..16e5ce3 --- /dev/null +++ b/examples/cxx/tree/README @@ -0,0 +1,70 @@ +This directory contains a number of examples that show how to use +the C++/Tree mapping. The following list gives an overview of +each example. See the README files in example directories for +more information on each example. + +hello + A simple "Hello, world!" example that shows how to parse XML + documents. + +library + Shows hot to handle more complex data structures, use the + ID/IDREF cross-referencing mechanism, use the xsd:enumeration + to C++ enum mapping, modify the object model, and serialize + the modified object model back to XML. + +polymorphism + Shows how to use XML Schema polymorphism features such as the + xsi:type attribute and substitution groups. + +xpath + Shows how to use the C++/Tree mapping together with XPath. + +wildcard + Shows how to use the optional wildcard mapping to parse, access, + modify, and serialize the XML data matched by XML Schema wildcards + (any and anyAttribute). + +mixed + Shows how to access the underlying DOM nodes to handle raw, "type- + less content" such as mixed content models, anyType/anySimpleType, + and any/anyAttribute. + +multiroot + Shows how to handle XML vocabularies with multiple root elements. + See also the messaging example. + +messaging + Shows how to handle XML vocabularies with multiple root elements + using the element type and element map features of the C++/Tree + mapping. + +caching + Shows how to parse several XML documents while reusing the + underlying XML parser and caching the schemas used for validation. + +performance + Measures the performance of parsing and serialization. This example + also shows how to structure your code to achieve the maximum + performance for these two operations. + +custom/ + A collection of examples that show how to customize the C++/Tree + mapping by using custom C++ classes instead of or in addition to + the generated ones. See the accompanying README file for an + overview of each example in this directory. + +streaming + Shows how to create an XML document by performing multiple + serializations of its smaller parts. This can be useful when the + document is too large to fit into memory or when the other end + needs to start processing without waiting for the whole document + (streaming). + +binary/ + A collection of examples that show how to serialize the object model + into a number of predefined and custom binary formats. + +dbxml + Shows how to use the C++/Tree mapping on top of the Berkeley DB + XML embedded XML database. diff --git a/examples/cxx/tree/binary/README b/examples/cxx/tree/binary/README new file mode 100644 index 0000000..365551e --- /dev/null +++ b/examples/cxx/tree/binary/README @@ -0,0 +1,16 @@ +This directory contains a number of examples that show how to serialize +the object model into a number of predefined and custom binary formats. +The following list gives an overview of each example: + +boost + Shows how to save/load the object model to/from a custom format + using the Boost serialization library as an example. + +cdr + Shows how to save/load the object model to/from CDR (Common Data + Representation) binary format using ACE CDR streams. + +xdr + Shows how to save/load the object model to/from XDR (eXternal Data + Representation) binary format using the XDR API provided as part of + Sun RPC. diff --git a/examples/cxx/tree/binary/boost/README b/examples/cxx/tree/binary/boost/README new file mode 100644 index 0000000..6cdd2dd --- /dev/null +++ b/examples/cxx/tree/binary/boost/README @@ -0,0 +1,49 @@ +This example shows how to save/load the object model to/from a custom +format using the Boost serialization library as an example. You will +need the Boost serialization library[1] installed in order to build +and run this example. + +[1] http://www.boost.org + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.xml + Sample XML instance document. + +boost-archive-extraction.hxx +boost-archive-insertion.hxx + Boost archive insertion and extraction operators for fundamental + types. You will need to provide a similar set of operators for + your own stream types. + +library-prologue.hxx + Contains a number of #include directives that are inserted into + the generated code by the XSD compiler. The included files are: + boost/archive/text_oarchive.hpp, boost/archive/text_oarchive.hpp, + boost-archive-insertion.hxx, and boost-archive-insertion.hxx. + +library.hxx +library.cxx + C++ types that represent the given vocabulary as well as Boost + archive insertion and extraction operations. These are generated + by the XSD compiler from library.xsd. The --hxx-prologue-file + option is used to insert the contents of the library-prologue.hxx + file into the generated header file. The --generate-insertion and + --generate-extraction options are used to generate the insertion + and extraction operations for text_oarchive and text_iarchive + types. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input XML file. It then + saves the object model to text_oarchive and loads it back from + text_iarchive. Additionally, it prints the resulting text + representation as well as the content of the object model before + saving it to text_oarchive and after loading it from text_iarchive. + +To run the example on the sample XML instance document simply execute: + +$ ./driver library.xml diff --git a/examples/cxx/tree/binary/boost/boost-archive-extraction.hxx b/examples/cxx/tree/binary/boost/boost-archive-extraction.hxx new file mode 100644 index 0000000..7711b28 --- /dev/null +++ b/examples/cxx/tree/binary/boost/boost-archive-extraction.hxx @@ -0,0 +1,188 @@ +// file : examples/cxx/tree/binary/boost/boost-archive-insertion.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef BOOST_ARCHIVE_EXTRACTION_HXX +#define BOOST_ARCHIVE_EXTRACTION_HXX + +#include // std::size_t +#include + +#include +#include + +#include + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // as_size + // + template + inline istream& + operator>> (istream& s, istream_common::as_size& x) + { + std::size_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + // 8-bit + // + template + inline istream& + operator>> (istream& s, istream_common::as_int8& x) + { + boost::int8_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + template + inline istream& + operator>> (istream& s, istream_common::as_uint8& x) + { + boost::uint8_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + + // 16-bit + // + template + inline istream& + operator>> (istream& s, istream_common::as_int16& x) + { + boost::int16_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + template + inline istream& + operator>> (istream& s, istream_common::as_uint16& x) + { + boost::uint16_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + + // 32-bit + // + template + inline istream& + operator>> (istream& s, istream_common::as_int32& x) + { + boost::int32_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + template + inline istream& + operator>> (istream& s, istream_common::as_uint32& x) + { + boost::uint32_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + + // 64-bit + // + template + inline istream& + operator>> (istream& s, istream_common::as_int64& x) + { + boost::int64_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + template + inline istream& + operator>> (istream& s, istream_common::as_uint64& x) + { + boost::uint64_t r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + + // Boolean + // + template + inline istream& + operator>> (istream& s, istream_common::as_bool& x) + { + bool r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + + // Floating-point + // + template + inline istream& + operator>> (istream& s, istream_common::as_float32& x) + { + float r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + template + inline istream& + operator>> (istream& s, istream_common::as_float64& x) + { + double r; + s.impl () >> r; + x.x_ = static_cast (r); + return s; + } + + // Extraction of std::basic_string. + // + + template + inline istream& + operator>> (istream& s, std::basic_string& x) + { + s.impl () >> x; + return s; + } + + + // Extraction of a binary buffer. + // + template + istream& + operator>> (istream& s, buffer& x) + { + std::size_t size; + s.impl () >> size; + x.size (size); + s.impl ().load_binary (x.data (), size); + } + } + } +} + +#endif // BOOST_ARCHIVE_EXTRACTION_HXX diff --git a/examples/cxx/tree/binary/boost/boost-archive-insertion.hxx b/examples/cxx/tree/binary/boost/boost-archive-insertion.hxx new file mode 100644 index 0000000..7a00ef8 --- /dev/null +++ b/examples/cxx/tree/binary/boost/boost-archive-insertion.hxx @@ -0,0 +1,177 @@ +// file : examples/cxx/tree/binary/boost/boost-archive-insertion.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef BOOST_ARCHIVE_INSERTION_HXX +#define BOOST_ARCHIVE_INSERTION_HXX + +#include // std::size_t +#include + +#include +#include + +#include + +namespace xsd +{ + namespace cxx + { + namespace tree + { + // as_size + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_size x) + { + std::size_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + // 8-bit + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_int8 x) + { + boost::int8_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + template + inline ostream& + operator<< (ostream& s, ostream_common::as_uint8 x) + { + boost::uint8_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + + // 16-bit + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_int16 x) + { + boost::int16_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + template + inline ostream& + operator<< (ostream& s, ostream_common::as_uint16 x) + { + boost::uint16_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + + // 32-bit + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_int32 x) + { + boost::int32_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + template + inline ostream& + operator<< (ostream& s, ostream_common::as_uint32 x) + { + boost::uint32_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + + // 64-bit + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_int64 x) + { + boost::int64_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + template + inline ostream& + operator<< (ostream& s, ostream_common::as_uint64 x) + { + boost::uint64_t v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + + // Boolean + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_bool x) + { + bool v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + + // Floating-point + // + template + inline ostream& + operator<< (ostream& s, ostream_common::as_float32 x) + { + float v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + template + inline ostream& + operator<< (ostream& s, ostream_common::as_float64 x) + { + double v (static_cast (x.x_)); + s.impl () << v; + return s; + } + + + // Insertion of std::basic_string. + // + template + inline ostream& + operator<< (ostream& s, const std::basic_string& x) + { + s.impl () << x; + return s; + } + + + // Insertion of a binary buffer. + // + template + ostream& + operator<< (ostream& s, const buffer& x) + { + // Boost.Serialization needs an lvalue. + // + std::size_t size (x.size()); + s.impl () << size; + s.impl ().save_binary (x.data (), x.size ()); + } + } + } +} + +#endif // BOOST_ARCHIVE_INSERTION_HXX diff --git a/examples/cxx/tree/binary/boost/driver.cxx b/examples/cxx/tree/binary/boost/driver.cxx new file mode 100644 index 0000000..9490d13 --- /dev/null +++ b/examples/cxx/tree/binary/boost/driver.cxx @@ -0,0 +1,73 @@ +// file : examples/cxx/tree/binary/boost/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include // std::memcpy +#include +#include + +// You can generate insertion/extraction code for other archive +// types (for example, binary, XML, etc). +// +#include +#include + +#include "library.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " library.xml" << endl; + return 1; + } + + try + { + using namespace library; + using boost::archive::text_oarchive; + using boost::archive::text_iarchive; + + // Read in the file. + // + std::auto_ptr c (catalog_ (argv[1])); + + cerr << *c << endl; + + // Save into a text archive. + // + std::ostringstream ostr; + text_oarchive oa (ostr); + xml_schema::ostream os (oa); + + os << *c; + + // Print the text representation. + // + std::string str (ostr.str ()); + + cerr << endl + << "text representation: " << endl + << str << endl; + + // Load from a text archive. + // + std::istringstream istr (str); + text_iarchive ia (istr); + xml_schema::istream is (ia); + + std::auto_ptr copy (new catalog (is)); + + cerr << *copy << endl; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/binary/boost/library-prologue.hxx b/examples/cxx/tree/binary/boost/library-prologue.hxx new file mode 100644 index 0000000..ba0d35f --- /dev/null +++ b/examples/cxx/tree/binary/boost/library-prologue.hxx @@ -0,0 +1,9 @@ +// Include declarations for the archive types. +// +#include +#include + +// Include insertion/extraction operators for fundamental types. +// +#include "boost-archive-insertion.hxx" +#include "boost-archive-extraction.hxx" diff --git a/examples/cxx/tree/binary/boost/library.xml b/examples/cxx/tree/binary/boost/library.xml new file mode 100644 index 0000000..da2bee6 --- /dev/null +++ b/examples/cxx/tree/binary/boost/library.xml @@ -0,0 +1,53 @@ + + + + + + + + 0679760806 + The Master and Margarita + fiction + + + Mikhail Bulgakov + 1891-05-15 + 1940-03-10 + + + + + + 0679600841 + War and Peace + history + + + Leo Tolstoy + 1828-09-09 + 1910-11-20 + + + + + + 0679420290 + Crime and Punishment + philosophy + + + Fyodor Dostoevsky + 1821-11-11 + 1881-02-09 + + + + diff --git a/examples/cxx/tree/binary/boost/library.xsd b/examples/cxx/tree/binary/boost/library.xsd new file mode 100644 index 0000000..9f35d4a --- /dev/null +++ b/examples/cxx/tree/binary/boost/library.xsd @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/binary/boost/makefile b/examples/cxx/tree/binary/boost/makefile new file mode 100644 index 0000000..f40c6d6 --- /dev/null +++ b/examples/cxx/tree/binary/boost/makefile @@ -0,0 +1,79 @@ +# file : examples/cxx/tree/binary/boost/makefile +# author : Boris Kolpackov +# 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 := library.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libboost/serialization/stub.make,\ + l: boost_serialization.l,cpp-options: boost_serialization.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) $(boost_serialization.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd -I$(src_root) +$(obj) $(dep): $(xerces_c.l.cpp-options) $(boost_serialization.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-ostream \ +--hxx-prologue-file $(src_base)/library-prologue.hxx \ +--generate-insertion boost::archive::text_oarchive \ +--generate-extraction boost::archive::text_iarchive + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/binary/cdr/README b/examples/cxx/tree/binary/cdr/README new file mode 100644 index 0000000..914d27c --- /dev/null +++ b/examples/cxx/tree/binary/cdr/README @@ -0,0 +1,36 @@ +This example shows how to save/load the object model to/from CDR +(Common Data Representation) binary format using ACE CDR streams. +Support for other data representation streams can be easily added. You +will need the ACE library[1] installed in order to build and run this +example. + +[1] http://www.cs.wustl.edu/~schmidt/ACE.html + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.xml + Sample XML instance document. + +library.hxx +library.cxx + C++ types that represent the given vocabulary as well as data + representation stream insertion and extraction operations. These + are generated by XSD from library.xsd. Note that the + --generate-insertion and --generate-extraction options are used + to generate the insertion and extraction operations for ACE CDR + stream. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input XML file. It then + saves the object model to ACE_OuputCDR and loads it back from + ACE_InputCDR. Additionally, it prints the resulting binary + representation as well as the content of the object model before + saving it to the CDR stream and after loading it from the CDR stream. + +To run the example on the sample XML instance document simply execute: + +$ ./driver library.xml diff --git a/examples/cxx/tree/binary/cdr/driver.cxx b/examples/cxx/tree/binary/cdr/driver.cxx new file mode 100644 index 0000000..08ec0d5 --- /dev/null +++ b/examples/cxx/tree/binary/cdr/driver.cxx @@ -0,0 +1,88 @@ +// file : examples/cxx/tree/binary/cdr/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include // std::memcpy +#include + +#include // ACE_HEX_DUMP +#include + +// The following two headers define XSD-specific insertion/extraction +// operations for ACE CDR streams. You can use the content of these +// headers as a guide to implementing insertion/extraction to/from +// your own data representation streams: +// +// xsd/cxx/tree/ace-cdr-stream-insertion.hxx +// xsd/cxx/tree/ace-cdr-stream-extraction.hxx + +#include "library.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " library.xml" << endl; + return 1; + } + + try + { + using namespace library; + + // Read in the file. + // + std::auto_ptr c (catalog_ (argv[1])); + + cerr << *c << endl; + + // Save to a CDR stream. + // + ACE_OutputCDR ace_ocdr; + xml_schema::ostream ocdr (ace_ocdr); + + ocdr << *c; + + // Print the binary representation and at the same time save + // it into a continuous buffer. + // + cerr << endl + << "binary representation size: " << ace_ocdr.total_length () << endl; + + xml_schema::buffer buf (ace_ocdr.total_length ()); + char* data (buf.data ()); + + for (const ACE_Message_Block* mb = ace_ocdr.begin (); + mb != 0; + mb = mb->cont ()) + { + std::memcpy (data, mb->rd_ptr (), mb->length ()); + data += mb->length (); + + ACE_HEX_DUMP ((LM_DEBUG, mb->rd_ptr (), mb->length ())); + } + + // Load from a CDR stream. Note that ACE_InputCDR expects the + // buffer to be properly aligned. Since our buffer is dynamically + // allocated, its alignment should be good enough. + // + ACE_InputCDR ace_icdr (buf.data (), buf.size ()); + xml_schema::istream icdr (ace_icdr); + + std::auto_ptr copy (new catalog (icdr)); + + cerr << *copy << endl; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } + + return 0; // ACE makes our main() an ordinary function. +} diff --git a/examples/cxx/tree/binary/cdr/library.xml b/examples/cxx/tree/binary/cdr/library.xml new file mode 100644 index 0000000..e7ccb3f --- /dev/null +++ b/examples/cxx/tree/binary/cdr/library.xml @@ -0,0 +1,53 @@ + + + + + + + + 0679760806 + The Master and Margarita + fiction + + + Mikhail Bulgakov + 1891-05-15 + 1940-03-10 + + + + + + 0679600841 + War and Peace + history + + + Leo Tolstoy + 1828-09-09 + 1910-11-20 + + + + + + 0679420290 + Crime and Punishment + philosophy + + + Fyodor Dostoevsky + 1821-11-11 + 1881-02-09 + + + + diff --git a/examples/cxx/tree/binary/cdr/library.xsd b/examples/cxx/tree/binary/cdr/library.xsd new file mode 100644 index 0000000..92d44d1 --- /dev/null +++ b/examples/cxx/tree/binary/cdr/library.xsd @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/binary/cdr/makefile b/examples/cxx/tree/binary/cdr/makefile new file mode 100644 index 0000000..e811695 --- /dev/null +++ b/examples/cxx/tree/binary/cdr/makefile @@ -0,0 +1,78 @@ +# file : examples/cxx/tree/binary/cdr/makefile +# author : Boris Kolpackov +# 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 := library.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libace/stub.make,\ + l: ace.l,cpp-options: ace.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) $(ace.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) $(ace.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-ostream \ +--generate-insertion ACE_OutputCDR \ +--generate-extraction ACE_InputCDR + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/binary/makefile b/examples/cxx/tree/binary/makefile new file mode 100644 index 0000000..f30fc66 --- /dev/null +++ b/examples/cxx/tree/binary/makefile @@ -0,0 +1,30 @@ +# file : examples/cxx/tree/binary/makefile +# author : Boris Kolpackov +# 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 + +examples := + +ifeq ($(xsd_with_boost_serialization),y) +examples += boost +endif + +ifeq ($(xsd_with_ace),y) +examples += cdr +endif + +ifeq ($(xsd_with_xdr),y) +examples += xdr +endif + +default := $(out_base)/ +clean := $(out_base)/.clean + +.PHONY: $(default) $(clean) + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(examples))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(examples))) + +$(foreach e,$(examples),$(call import,$(src_base)/$e/makefile)) diff --git a/examples/cxx/tree/binary/xdr/README b/examples/cxx/tree/binary/xdr/README new file mode 100644 index 0000000..22d5693 --- /dev/null +++ b/examples/cxx/tree/binary/xdr/README @@ -0,0 +1,34 @@ +This example shows how to save/load the object model to/from XDR +(eXternal Data Representation) binary format using XDR streams. +The XDR API is available out of the box on most UNIX and GNU/Linux +systems as part of Sun RPC. On Windows you may need to install a +third-party library which provides the XDR API. + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.xml + Sample XML instance document. + +library.hxx +library.cxx + C++ types that represent the given vocabulary as well as data + representation stream insertion and extraction operations. These + are generated by XSD from library.xsd. Note that the + --generate-insertion and --generate-extraction options are used + to generate the insertion and extraction operations for XDR + stream. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input XML file. It then + saves the object model to the XDR representation and loads it back. + Additionally, it prints the content of the object model before saving + it to the XDR representation and after loading it from the XDR + representation. + +To run the example on the sample XML instance document simply execute: + +$ ./driver library.xml diff --git a/examples/cxx/tree/binary/xdr/driver.cxx b/examples/cxx/tree/binary/xdr/driver.cxx new file mode 100644 index 0000000..495eafc --- /dev/null +++ b/examples/cxx/tree/binary/xdr/driver.cxx @@ -0,0 +1,149 @@ +// file : examples/cxx/tree/binary/xdr/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include // std::memcpy +#include // std::size_t +#include + +#include +#include + +#include "library.hxx" + +using std::cerr; +using std::endl; +using std::size_t; + +// XDR output functions. Their implementations are provided after main(). +// +struct underflow_info +{ + xml_schema::buffer* buf; + size_t pos; +}; + +extern "C" int +overflow (void* user_data, char* buf, int n); + +extern "C" int +underflow (void* user_data, char* buf, int n); + +// The xdrrec_create function (used below) has slightly different +// prototypes on different platforms. To make this example 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] << " library.xml" << endl; + return 1; + } + + try + { + using namespace library; + + xdrrec_create_p xdrrec_create_ = + reinterpret_cast (::xdrrec_create); + + // Read in the file. + // + std::auto_ptr c (catalog_ (argv[1])); + + cerr << *c << endl; + + // Save to an XDR stream. + // + XDR xdr; + xml_schema::buffer buf; + + xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&buf), 0, &overflow); + xdr.x_op = XDR_ENCODE; + + xml_schema::ostream oxdr (xdr); + + oxdr << *c; + + xdrrec_endofrecord (&xdr, true); // Flush the data. + xdr_destroy (&xdr); + + // The binary representation is now in the memory buffer 'buf'. + // To get to the raw data use buf.data() and buf.size(). + // + cerr << endl + << "binary representation size: " << buf.size () << endl; + + // Load from an XDR stream. + // + underflow_info ui; + ui.buf = &buf; + ui.pos = 0; + + xdrrec_create_ (&xdr, 0, 0, reinterpret_cast (&ui), &underflow, 0); + xdr.x_op = XDR_DECODE; + + xdrrec_skiprecord (&xdr); + + xml_schema::istream ixdr (xdr); + + std::auto_ptr copy (new catalog (ixdr)); + + xdr_destroy (&xdr); + + cerr << *copy << endl; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} + +extern "C" int +overflow (void* p, char* buf, int n_) +{ + xml_schema::buffer* dst (reinterpret_cast (p)); + size_t n (static_cast (n_)); + + size_t size (dst->size ()); + size_t capacity (dst->capacity ()); + + // Implement exponential growth. + // + if (size + n > capacity && size + n < capacity * 2) + dst->capacity (capacity * 2); + + dst->size (size + n); + std::memcpy (dst->data () + size, buf, n); + + return n; +} + +extern "C" int +underflow (void* p, char* buf, int n_) +{ + underflow_info* ui (reinterpret_cast (p)); + size_t n (static_cast (n_)); + + size_t size (ui->buf->size () - ui->pos); + n = size > n ? n : size; + + std::memcpy (buf, ui->buf->data () + ui->pos, n); + ui->pos += n; + + return n; +} diff --git a/examples/cxx/tree/binary/xdr/library.xml b/examples/cxx/tree/binary/xdr/library.xml new file mode 100644 index 0000000..9ddcd5a --- /dev/null +++ b/examples/cxx/tree/binary/xdr/library.xml @@ -0,0 +1,53 @@ + + + + + + + + 0679760806 + The Master and Margarita + fiction + + + Mikhail Bulgakov + 1891-05-15 + 1940-03-10 + + + + + + 0679600841 + War and Peace + history + + + Leo Tolstoy + 1828-09-09 + 1910-11-20 + + + + + + 0679420290 + Crime and Punishment + philosophy + + + Fyodor Dostoevsky + 1821-11-11 + 1881-02-09 + + + + diff --git a/examples/cxx/tree/binary/xdr/library.xsd b/examples/cxx/tree/binary/xdr/library.xsd new file mode 100644 index 0000000..9999e72 --- /dev/null +++ b/examples/cxx/tree/binary/xdr/library.xsd @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/binary/xdr/makefile b/examples/cxx/tree/binary/xdr/makefile new file mode 100644 index 0000000..6414fe9 --- /dev/null +++ b/examples/cxx/tree/binary/xdr/makefile @@ -0,0 +1,78 @@ +# file : examples/cxx/tree/binary/xdr/makefile +# author : Boris Kolpackov +# 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 := library.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libace/stub.make,\ + l: ace.l,cpp-options: ace.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) $(ace.l) -lnsl + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) $(ace.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-ostream \ +--generate-insertion XDR \ +--generate-extraction XDR + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/caching/README b/examples/cxx/tree/caching/README new file mode 100644 index 0000000..1bbb590 --- /dev/null +++ b/examples/cxx/tree/caching/README @@ -0,0 +1,29 @@ +This example shows how to use the the C++/Tree mapping to parse several +XML documents while reusing the underlying XML parser and caching the +schemas used for validation. + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.xml + Sample XML instance document. + +library.hxx +library.cxx + C++ types that represent the given vocabulary and a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model. These are generated by XSD from library.xsd. + +driver.cxx + Driver for the example. It first sets up the Xerces-C++ DOM parser + and caches the library.xsd schema for validation. It then performs + ten iterations that parse the input file to a DOM document using + the DOM parser and call one of the parsing functions that constructs + the object model from this DOM document. On each iteration the driver + prints a number of book in the object model to STDERR. + +To run the example on the sample XML instance document simply execute: + +$ ./driver library.xml diff --git a/examples/cxx/tree/caching/driver.cxx b/examples/cxx/tree/caching/driver.cxx new file mode 100644 index 0000000..5c3405a --- /dev/null +++ b/examples/cxx/tree/caching/driver.cxx @@ -0,0 +1,179 @@ +// file : examples/cxx/tree/caching/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include + +#include +#include // chLatin_* +#include +#include // xercesc::Grammar +#include + +#include +#include +#include + +#include +#include + +#include "library.hxx" + +using namespace std; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " library.xml" << endl; + return 1; + } + + int r (0); + + // We need to initialize the Xerces-C++ runtime because we + // are doing the XML-to-DOM parsing ourselves. + // + xercesc::XMLPlatformUtils::Initialize (); + + try + { + using namespace xercesc; + namespace xml = xsd::cxx::xml; + namespace tree = xsd::cxx::tree; + + const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull}; + + // Get an implementation of the Load-Store (LS) interface. + // + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + +#if _XERCES_VERSION >= 30000 + + // Xerces-C++ 3.0.0 and later. + // + xml::dom::auto_ptr 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, true); + conf->setParameter (XMLUni::fgXercesSchema, true); + conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + + // Initialize the schema cache. + // + parser->loadGrammar ("library.xsd", Grammar::SchemaGrammarType, true); + conf->setParameter (XMLUni::fgXercesUseCachedGrammarInParse, true); + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + +#else // _XERCES_VERSION >= 30000 + + // Same as above but for Xerces-C++ 2 series. + // + xml::dom::auto_ptr parser ( + impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + + parser->setFeature (XMLUni::fgDOMComments, false); + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + parser->setFeature (XMLUni::fgDOMEntities, false); + parser->setFeature (XMLUni::fgDOMNamespaces, true); + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + parser->setFeature (XMLUni::fgDOMValidation, true); + parser->setFeature (XMLUni::fgXercesSchema, true); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + parser->setErrorHandler (&ehp); + + parser->loadGrammar ("library.xsd", Grammar::SchemaGrammarType, true); + parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true); + + parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); + +#endif // _XERCES_VERSION >= 30000 + + // Parse XML documents. + // + for (unsigned long i (0); i < 10; ++i) + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + // Wrap the standard input stream. + // + xml::sax::std_input_source isrc (ifs, argv[1]); + Wrapper4InputSource wrap (&isrc, false); + + // Parse XML to DOM. + // +#if _XERCES_VERSION >= 30000 + xml_schema::dom::auto_ptr doc (parser->parse (&wrap)); +#else + xml_schema::dom::auto_ptr doc (parser->parse (wrap)); +#endif + + eh.throw_if_failed > (); + + // Parse DOM to the object model. + // + auto_ptr c (library::catalog_ (*doc)); + + cerr << "catalog with " << c->book ().size () << " books" << endl; + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + xercesc::XMLPlatformUtils::Terminate (); + return r; +} diff --git a/examples/cxx/tree/caching/library.xml b/examples/cxx/tree/caching/library.xml new file mode 100644 index 0000000..4c12c6e --- /dev/null +++ b/examples/cxx/tree/caching/library.xml @@ -0,0 +1,53 @@ + + + + + + + + 0679760806 + The Master and Margarita + fiction + + + Mikhail Bulgakov + 1891-05-15 + 1940-03-10 + + + + + + 0679600841 + War and Peace + history + + + Leo Tolstoy + 1828-09-09 + 1910-11-20 + + + + + + 0679420290 + Crime and Punishment + philosophy + + + Fyodor Dostoevsky + 1821-11-11 + 1881-02-09 + + + + diff --git a/examples/cxx/tree/caching/library.xsd b/examples/cxx/tree/caching/library.xsd new file mode 100644 index 0000000..5dca460 --- /dev/null +++ b/examples/cxx/tree/caching/library.xsd @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/caching/makefile b/examples/cxx/tree/caching/makefile new file mode 100644 index 0000000..2f4beaa --- /dev/null +++ b/examples/cxx/tree/caching/makefile @@ -0,0 +1,71 @@ +# file : examples/cxx/tree/caching/makefile +# author : Boris Kolpackov +# 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 := library.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/README b/examples/cxx/tree/custom/README new file mode 100644 index 0000000..482f5a9 --- /dev/null +++ b/examples/cxx/tree/custom/README @@ -0,0 +1,37 @@ +This directory contains a number of examples that show how to customize the +C++/Tree mapping. The following list gives an overview of each example: + +calendar + Shows how to customize XML Schema built-in types by mapping xsd:date + built-in type to the date class from the Boost date_time library. + +comments + This example shows how to customize the anyType XML Schema built-in + type to implement preservation of comments stored in XML documents. + Because anyType is a base type for every generated type, you can use + this technique to implement custom functionality that spans the + entire type system. + +contacts + Shows how to map a user-defined XML Schema type to a custom C++ class. + This example presents the simple case where the customized type is not + used as a base in the same schema. + +double + Shows how to customize parsing and serialization code for the xsd:double + XML Schema built-in type. It can be used as a guide on how to customize + built-in XML Schema types that are mapped to fundamental C++ types. + +taxonomy + Shows how to map user-defined XML Schema types to custom C++ classes. + This example presents the complex case where the customized types are + inherited from in the same schema. + +wildcard + Shows how to use type customization to parse and serialize a specific + attribute that is matched by a wildcard (anyAttribute). + +For more information on the C++/Tree mapping customization see the +C++/Tree Mapping Customization Guide[1]. + +[1] http://wiki.codesynthesis.com/Tree/Customization_guide diff --git a/examples/cxx/tree/custom/calendar/README b/examples/cxx/tree/custom/calendar/README new file mode 100644 index 0000000..f7f6989 --- /dev/null +++ b/examples/cxx/tree/custom/calendar/README @@ -0,0 +1,47 @@ +This example shows how to customize the XML Schema built-in types by mapping +xsd:date built-in type to the date class from the Boost date_time library. +You will need the Boost date_time library[1] installed in order to build +and run this example. For more information on the C++/Tree mapping +customization see the C++/Tree Mapping Customization Guide[2]. + +[1] http://www.boost.org +[2] http://wiki.codesynthesis.com/Tree/Customization_guide + +The example consists of the following files: + +calendar.xsd + XML Schema definition for a simple calendar format. + +calendar.xml + Sample XML instance document. + +xml-schema.hxx + C++ types for XML Schema built-in types. This header file is generated + by XSD using the --generate-xml-schema option. The --custom-type option + is also used to customize the xsd:date type. + +calendar.hxx +calendar.ixx +calendar.cxx + C++ types that represent the given vocabulary and a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model. These are generated by XSD from calendar.xsd with the + --extern-xml-schema option in order to include xml-schema.hxx. + +xml-schema-custom.hxx + Header file which defines our own xml_schema::date class. It is + included at the end of xml-schema.hxx using the --hxx-epilogue + option. + +xml-schema-custom.cxx + Source file which contains the implementation of our xml_schema:date + class. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the calendar events to STDERR. + +To run the example on the sample XML instance document simply execute: + +$ ./driver calendar.xml diff --git a/examples/cxx/tree/custom/calendar/calendar.xml b/examples/cxx/tree/custom/calendar/calendar.xml new file mode 100644 index 0000000..ae9e570 --- /dev/null +++ b/examples/cxx/tree/custom/calendar/calendar.xml @@ -0,0 +1,23 @@ + + + + + + + + Don't forget to change the tire. + + + + Can be cancelled if it is too cold. + + + diff --git a/examples/cxx/tree/custom/calendar/calendar.xsd b/examples/cxx/tree/custom/calendar/calendar.xsd new file mode 100644 index 0000000..fa612a7 --- /dev/null +++ b/examples/cxx/tree/custom/calendar/calendar.xsd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/custom/calendar/driver.cxx b/examples/cxx/tree/custom/calendar/driver.cxx new file mode 100644 index 0000000..02f1c27 --- /dev/null +++ b/examples/cxx/tree/custom/calendar/driver.cxx @@ -0,0 +1,40 @@ +// file : examples/cxx/tree/custom/calendar/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "calendar.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " calendar.xml" << endl; + return 1; + } + + try + { + using namespace calendar; + + std::auto_ptr e (events_ (argv[1])); + + for (events::event_const_iterator i (e->event ().begin ()); + i != e->event ().end (); ++i) + { + cerr << i->date () << " " << i->title () << endl + << *i << endl; + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/custom/calendar/makefile b/examples/cxx/tree/custom/calendar/makefile new file mode 100644 index 0000000..36525aa --- /dev/null +++ b/examples/cxx/tree/custom/calendar/makefile @@ -0,0 +1,90 @@ +# file : examples/cxx/tree/custom/calendar/makefile +# author : Boris Kolpackov +# 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 := calendar.xsd +cxx := driver.cxx xml-schema-custom.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libboost/date-time/stub.make,\ + l: boost_date_time.l,cpp-options: boost_date_time.l.cpp-options) + +# Build. +# +$(driver): $(obj) $(xerces_c.l) $(boost_date_time.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) $(boost_date_time.l.cpp-options) + +# Header file for XML Schema namespace. +# +$(out_base)/xml-schema.hxx: $(out_root)/xsd/xsd + $(call message,xsd $(src_base)/xml-schema.xsd,\ +$(out_root)/xsd/xsd cxx-tree --output-dir $(out_base) --generate-xml-schema \ +--custom-type date \ +--hxx-epilogue '\#include "xml-schema-custom.hxx"' xml-schema.xsd) + +# +# +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +# We have to double-escape '#' because the message function +# (which is used in command scripts) expands things twice. +# +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-inline \ +--extern-xml-schema xml-schema.xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# 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) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/calendar/xml-schema-custom.cxx b/examples/cxx/tree/custom/calendar/xml-schema-custom.cxx new file mode 100644 index 0000000..440a407 --- /dev/null +++ b/examples/cxx/tree/custom/calendar/xml-schema-custom.cxx @@ -0,0 +1,57 @@ +// file : examples/cxx/tree/custom/calendar/xml-schema-custom.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Include xml-schema.hxx instead of xml-schema-custom.hxx here. +// +#include "xml-schema.hxx" + +#include // xsd::cxx::xml::transcode +#include // xsd::cxx::tree::text_content + +using namespace boost; +using namespace boost::gregorian; + +namespace xml_schema +{ + date:: + date (const xercesc::DOMElement& e, flags f, container* c) + : simple_type (e, f, c), + gregorian::date ( + from_simple_string ( + xsd::cxx::tree::text_content (e))) + { + } + + date:: + date (const xercesc::DOMAttr& a, flags f, container* c) + : simple_type (a, f, c), + gregorian::date ( + from_simple_string ( + xsd::cxx::xml::transcode (a.getValue ()))) + { + } + + date:: + date (const std::string& s, + const xercesc::DOMElement* e, + flags f, + container* c) + : simple_type (s, e, f, c), + gregorian::date (from_simple_string (s)) + { + } + + date:: + date (const date& d, flags f, container* c) + : simple_type (d, f, c), + gregorian::date (d) + { + } + + date* date:: + _clone (flags f, container* c) const + { + return new date (*this, f, c); + } +} diff --git a/examples/cxx/tree/custom/calendar/xml-schema-custom.hxx b/examples/cxx/tree/custom/calendar/xml-schema-custom.hxx new file mode 100644 index 0000000..2bab0b5 --- /dev/null +++ b/examples/cxx/tree/custom/calendar/xml-schema-custom.hxx @@ -0,0 +1,34 @@ +// file : examples/cxx/tree/custom/calendar/xml-schema-custom.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use xml-schema.hxx instead. This +// file is included into generated xml-schema.hxx so we do not need to +// guard against multiple inclusions. +// + +#include // boost::gregorian::date + +namespace xml_schema +{ + class date: public simple_type, + public boost::gregorian::date + { + public: + // Parsing c-tors: element, attribute, and list item. + // + date (const xercesc::DOMElement&, flags = 0, container* = 0); + date (const xercesc::DOMAttr&, flags = 0, container* = 0); + date (const std::string&, + const xercesc::DOMElement*, + flags = 0, + container* = 0); + + // Copy c-tor and _clone. + // + date (const date&, flags = 0, container* = 0); + + virtual date* + _clone (flags = 0, container* = 0) const; + }; +} diff --git a/examples/cxx/tree/custom/comments/README b/examples/cxx/tree/custom/comments/README new file mode 100644 index 0000000..8fd69d0 --- /dev/null +++ b/examples/cxx/tree/custom/comments/README @@ -0,0 +1,57 @@ +This example shows how to customize the anyType XML Schema built-in +type to implement preservation of comments stored in XML documents. +Because anyType is a base type for every generated type, you can use +this technique to implement custom functionality that spans the +entire type system. For more information on the C++/Tree mapping +customization see the C++/Tree Mapping Customization Guide[2]. + +[2] http://wiki.codesynthesis.com/Tree/Customization_guide + +The example consists of the following files: + +people.xsd + XML Schema definition for a simple person record vocabulary. + +people.xml + Sample XML instance document. + +xml-schema.hxx + C++ types for XML Schema built-in types. This header file is generated + by XSD using the --generate-xml-schema option. The --custom-type option + is also used to customize the xsd:anyType type. + +people.hxx +people.ixx +people.cxx + C++ types that represent the person record vocabulary, a set of + parsing functions that convert XML instance documents to a tree-like + in-memory object model, and a set of serialization functions that + convert the object model back to XML. These are generated by XSD + from people.xsd with the --extern-xml-schema option in order to + include xml-schema.hxx. + +xml-schema-custom.hxx + Header file which defines our own xml_schema::type class. It is + included at the end of xml-schema.hxx using the --hxx-epilogue + option. + +xml-schema-custom.cxx + Source file which contains the implementation of our xml_schema:type + class. + +dom-parse.hxx +dom-parse.cxx + Definition and implementation of the parse() function that + parses an XML document to a DOM document while preserving + XML comments. + +driver.cxx + Driver for the example. It first calls the above parse() function + to parse the input file to a DOM document. It then parses the DOM + document to the object model and performs a number of modifications + on this object model. Finally, it serializes the modified object + model back to XML, including XML comments. + +To run the example on the sample XML instance document simply execute: + +$ ./driver people.xml diff --git a/examples/cxx/tree/custom/comments/dom-parse.cxx b/examples/cxx/tree/custom/comments/dom-parse.cxx new file mode 100644 index 0000000..7ad6aa5 --- /dev/null +++ b/examples/cxx/tree/custom/comments/dom-parse.cxx @@ -0,0 +1,118 @@ +// file : examples/cxx/tree/custom/comments/dom-parse.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include "dom-parse.hxx" + +#include + +#include +#include // chLatin_* +#include + +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +xml::dom::auto_ptr +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)); + +#if _XERCES_VERSION >= 30000 + + // Xerces-C++ 3.0.0 and later. + // + xml::dom::auto_ptr 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); + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + +#else // _XERCES_VERSION >= 30000 + + // Same as above but for Xerces-C++ 2 series. + // + xml::dom::auto_ptr parser ( + impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + parser->setFeature (XMLUni::fgDOMComments, false); + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + parser->setFeature (XMLUni::fgDOMEntities, false); + parser->setFeature (XMLUni::fgDOMNamespaces, true); + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + parser->setFeature (XMLUni::fgDOMValidation, validate); + parser->setFeature (XMLUni::fgXercesSchema, validate); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + parser->setErrorHandler (&ehp); + +#endif // _XERCES_VERSION >= 30000 + + // Prepare input stream. + // + xml::sax::std_input_source isrc (is, id); + Wrapper4InputSource wrap (&isrc, false); + +#if _XERCES_VERSION >= 30000 + xml::dom::auto_ptr doc (parser->parse (&wrap)); +#else + xml::dom::auto_ptr doc (parser->parse (wrap)); +#endif + + eh.throw_if_failed > (); + + return doc; +} diff --git a/examples/cxx/tree/custom/comments/dom-parse.hxx b/examples/cxx/tree/custom/comments/dom-parse.hxx new file mode 100644 index 0000000..05bfa2e --- /dev/null +++ b/examples/cxx/tree/custom/comments/dom-parse.hxx @@ -0,0 +1,23 @@ +// file : examples/cxx/tree/custom/comments/dom-parse.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include +#include + +#include +#include + +// 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::cxx::xml::dom::auto_ptr +parse (std::istream& is, + const std::string& id, + bool validate); + +#endif // DOM_PARSE diff --git a/examples/cxx/tree/custom/comments/driver.cxx b/examples/cxx/tree/custom/comments/driver.cxx new file mode 100644 index 0000000..4ce2573 --- /dev/null +++ b/examples/cxx/tree/custom/comments/driver.cxx @@ -0,0 +1,91 @@ +// file : examples/cxx/tree/custom/commens/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include + +#include +#include + +#include "people.hxx" +#include "dom-parse.hxx" + +using namespace std; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " people.xml" << endl; + return 1; + } + + int r (0); + + // We need to initialize the Xerces-C++ runtime because we + // are doing the XML-to-DOM parsing ourselves (see below). + // + xercesc::XMLPlatformUtils::Initialize (); + + try + { + using namespace people; + namespace xml = xsd::cxx::xml; + + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + // For performance reasons the internal XML to DOM parsing code + // discards comments in the resulting DOM document. To overcome + // this we are going to use our own parse() function from + // dom-parse.hxx that preserves comments in the resulting DOM + // documents. + // + xml_schema::dom::auto_ptr doc ( + parse (ifs, argv[1], true)); + + // Parse the DOM document to the object model. + // + std::auto_ptr c (catalog_ (*doc)); + + // Change the object model. + // + catalog::person_sequence& ps (c->person ()); + + for (catalog::person_iterator i (ps.begin ()); i != ps.end (); ++i) + { + i->age (i->age () + 1); + } + + person john ("John Doe", 30); + john.comment ("Record for John Doe"); + + ps.push_back (john); + + // Serialize. + // + xml_schema::namespace_infomap map; + + map["ppl"].name = "http://www.codesynthesis.com/people"; + map["ppl"].schema = "people.xsd"; + + catalog_ (std::cout, *c, map); + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + xercesc::XMLPlatformUtils::Terminate (); + return r; +} diff --git a/examples/cxx/tree/custom/comments/makefile b/examples/cxx/tree/custom/comments/makefile new file mode 100644 index 0000000..a12b3fe --- /dev/null +++ b/examples/cxx/tree/custom/comments/makefile @@ -0,0 +1,84 @@ +# file : examples/cxx/tree/custom/comments/makefile +# author : Boris Kolpackov +# 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 := people.xsd +cxx := driver.cxx xml-schema-custom.cxx dom-parse.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +# Header file for XML Schema namespace. +# +$(out_base)/xml-schema.hxx: $(out_root)/xsd/xsd + $(call message,xsd $(src_base)/xml-schema.xsd,\ +$(out_root)/xsd/xsd cxx-tree --output-dir $(out_base) --generate-xml-schema \ +--generate-serialization --custom-type anyType=/type_base \ +--hxx-epilogue '\#include "xml-schema-custom.hxx"' xml-schema.xsd) + +# +# +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-inline \ +--generate-serialization \ +--extern-xml-schema xml-schema.xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# 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) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/comments/people.xml b/examples/cxx/tree/custom/comments/people.xml new file mode 100644 index 0000000..b6a44e5 --- /dev/null +++ b/examples/cxx/tree/custom/comments/people.xml @@ -0,0 +1,21 @@ + + + + + + + + + Joe Dirt + 28 + + + diff --git a/examples/cxx/tree/custom/comments/people.xsd b/examples/cxx/tree/custom/comments/people.xsd new file mode 100644 index 0000000..2f40754 --- /dev/null +++ b/examples/cxx/tree/custom/comments/people.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/custom/comments/xml-schema-custom.cxx b/examples/cxx/tree/custom/comments/xml-schema-custom.cxx new file mode 100644 index 0000000..d86d6af --- /dev/null +++ b/examples/cxx/tree/custom/comments/xml-schema-custom.cxx @@ -0,0 +1,118 @@ +// file : examples/cxx/tree/custom/comments/xml-schema-custom.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Include xml-schema.hxx instead of xml-schema-custom.hxx here. +// +#include "xml-schema.hxx" + +#include +#include + +#include // xml::transcode, xml::string + +namespace xml = xsd::cxx::xml; + +namespace xml_schema +{ + type:: + type () + : type_base () + { + } + + type:: + type (const xercesc::DOMElement& e, flags f, container* c) + : type_base (e, f, c) + { + using namespace xercesc; + + // Here we are only handling a comment that is the first + // node in the element's content. + // + const DOMNode* n (e.getFirstChild ()); + + if (n != 0 && n->getNodeType () == DOMNode::COMMENT_NODE) + { + const DOMComment* c (static_cast (n)); + comment_ = xml::transcode (c->getData ()); + } + } + + type:: + type (const xercesc::DOMAttr& a, flags f, container* c) + : type_base (a, f, c) + { + // No comments for attributes. + // + } + + type:: + type (const std::string& s, const xercesc::DOMElement* e, + flags f, container* c) + : type_base (s, e, f, c) + { + // No comments for list items. + // + } + + type:: + type (const type& x, flags f, container* c) + : type_base (x, f, c), comment_ (x.comment_) + { + } + + type* type:: + _clone (flags f, container* c) const + { + return new type (*this, f, c); + } + + // Serialization operators. + // + void + operator<< (xercesc::DOMElement& e, const type& x) + { + // Call our base first. + // + const type_base& b (x); + e << b; + + // Add the comment if any. + // + const std::string s (x.comment ()); + + if (!s.empty ()) + { + using namespace xercesc; + + DOMDocument* doc (e.getOwnerDocument ()); + DOMComment* c (doc->createComment (xml::string (s).c_str ())); + e.appendChild (c); + } + } + + void + operator<< (xercesc::DOMAttr& a, const type& x) + { + // Call our base first. + // + const type_base& b (x); + a << b; + + // No comments for attributes. + // + } + + void + operator<< (xml_schema::list_stream& ls, const type& x) + { + // Call our base first. + // + const type_base& b (x); + ls << b; + + // No comments for list items. + // + } +} diff --git a/examples/cxx/tree/custom/comments/xml-schema-custom.hxx b/examples/cxx/tree/custom/comments/xml-schema-custom.hxx new file mode 100644 index 0000000..821d0dd --- /dev/null +++ b/examples/cxx/tree/custom/comments/xml-schema-custom.hxx @@ -0,0 +1,58 @@ +// file : examples/cxx/tree/custom/comments/xml-schema-custom.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use xml-schema.hxx instead. This +// file is included into generated xml-schema.hxx so we do not need to +// guard against multiple inclusions. +// + +#include + +namespace xml_schema +{ + // When customizing anyType always inherit from the original type. + // + class type: public type_base + { + public: + type (); + type (const xercesc::DOMElement&, flags = 0, container* = 0); + type (const xercesc::DOMAttr&, flags = 0, container* = 0); + type (const std::string&, const xercesc::DOMElement*, + flags = 0, container* = 0); + type (const type&, flags = 0, container* = 0); + + virtual type* + _clone (flags = 0, container* = 0) const; + + public: + // Comment manipulation API. + // + const std::string& + comment () const + { + return comment_; + } + + void + comment (const std::string& c) + { + comment_ = c; + } + + private: + std::string comment_; + }; + + // New serialization operators. + // + void + operator<< (xercesc::DOMElement&, const type&); + + void + operator<< (xercesc::DOMAttr&, const type&); + + void + operator<< (xml_schema::list_stream&, const type&); +} diff --git a/examples/cxx/tree/custom/contacts/README b/examples/cxx/tree/custom/contacts/README new file mode 100644 index 0000000..a3b237c --- /dev/null +++ b/examples/cxx/tree/custom/contacts/README @@ -0,0 +1,40 @@ +This example shows how to map a user-defined XML Schema type to a custom +C++ class. It presents the simple case where the customized type is not +used as a base in the same schema. For the complex case see the taxonomy +example. For more information on the C++/Tree mapping customization see +the C++/Tree Mapping Customization Guide[1]. + +[1] http://wiki.codesynthesis.com/Tree/Customization_guide + +The example consists of the following files: + +contacts.xsd + XML Schema definition for a simple contacts database. + +contacts.xml + Sample XML instance document. + +contacts.hxx +contacts.ixx +contacts.cxx + C++ types that represent the given vocabulary and a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model. These are generated by XSD from contacts.xsd with the + --custom-type option in order to to customize the contact type. + +contacts-custom.hxx + Header file which defines our own contact class by inheriting from the + generated contact_base. It is included at the end of contacts.hxx using + the --hxx-epilogue option. + +contacts-custom.cxx + Source file which contains the implementation of our contact class. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the contacts to STDERR. + +To run the example on the sample XML instance document simply execute: + +$ ./driver contacts.xml diff --git a/examples/cxx/tree/custom/contacts/contacts-custom.cxx b/examples/cxx/tree/custom/contacts/contacts-custom.cxx new file mode 100644 index 0000000..dd7c453 --- /dev/null +++ b/examples/cxx/tree/custom/contacts/contacts-custom.cxx @@ -0,0 +1,51 @@ +// file : examples/cxx/tree/custom/contacts/contacts-custom.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include + +// Include contacts.hxx instead of contacts-custom.hxx here. +// +#include "contacts.hxx" + +namespace contacts +{ + // We implement the following constructs by simply forwarding + // to our base. + // + contact:: + contact (const name_type& n, + const email_type& e, + const phone_type& p) + : contact_base (n, e, p) + { + } + + contact:: + contact (const xercesc::DOMElement& e, + xml_schema::flags f, + xml_schema::container* c) + : contact_base (e, f, c) + { + } + + contact:: + contact (const contact& x, + xml_schema::flags f, + xml_schema::container* c) + : contact_base (x, f, c) + { + } + + contact* contact:: + _clone (xml_schema::flags f, xml_schema::container* c) const + { + return new contact (*this, f, c); + } + + void contact:: + print (std::ostream& os) const + { + os << name () << " e| " << email () << " t| " << phone () << std::endl; + } +} diff --git a/examples/cxx/tree/custom/contacts/contacts-custom.hxx b/examples/cxx/tree/custom/contacts/contacts-custom.hxx new file mode 100644 index 0000000..fdb6810 --- /dev/null +++ b/examples/cxx/tree/custom/contacts/contacts-custom.hxx @@ -0,0 +1,44 @@ +// file : examples/cxx/tree/custom/contacts/contacts-custom.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use contacts.hxx instead. This +// file is included into generated contacts.hxx so we do not need to +// guard against multiple inclusions. +// + +#include // std::ostream + +namespace contacts +{ + class contact: public contact_base + { + // The following constructor signatures are copied from + // contact_base except for the copy constructor and the + // _clone function where we had to change the type from + // contact_base to contact. + // + public: + contact (const name_type&, + const email_type&, + const phone_type&); + + contact (const xercesc::DOMElement&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + contact (const contact&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + virtual contact* + _clone (xml_schema::flags = 0, + xml_schema::container* = 0) const; + + // Our customizations. + // + public: + void + print (std::ostream&) const; + }; +} diff --git a/examples/cxx/tree/custom/contacts/contacts.xml b/examples/cxx/tree/custom/contacts/contacts.xml new file mode 100644 index 0000000..c6dc38f --- /dev/null +++ b/examples/cxx/tree/custom/contacts/contacts.xml @@ -0,0 +1,21 @@ + + + + + + + + Joe Dirt + joe@dirt.com + 555 DIRT + + + diff --git a/examples/cxx/tree/custom/contacts/contacts.xsd b/examples/cxx/tree/custom/contacts/contacts.xsd new file mode 100644 index 0000000..da73c78 --- /dev/null +++ b/examples/cxx/tree/custom/contacts/contacts.xsd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/custom/contacts/driver.cxx b/examples/cxx/tree/custom/contacts/driver.cxx new file mode 100644 index 0000000..9015e87 --- /dev/null +++ b/examples/cxx/tree/custom/contacts/driver.cxx @@ -0,0 +1,39 @@ +// file : examples/cxx/tree/custom/contacts/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "contacts.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " contacts.xml" << endl; + return 1; + } + + try + { + using namespace contacts; + + std::auto_ptr c (catalog_ (argv[1])); + + for (catalog::contact_const_iterator i (c->contact ().begin ()); + i != c->contact ().end (); ++i) + { + i->print (cerr); + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/custom/contacts/makefile b/examples/cxx/tree/custom/contacts/makefile new file mode 100644 index 0000000..9a8dc89 --- /dev/null +++ b/examples/cxx/tree/custom/contacts/makefile @@ -0,0 +1,77 @@ +# file : examples/cxx/tree/custom/contacts/makefile +# author : Boris Kolpackov +# 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 := contacts.xsd +cxx := driver.cxx contacts-custom.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +# We have to double-escape '#' because the message function +# (which is used in command scripts) expands things twice. +# +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-inline \ +--custom-type contact=/contact_base \ +--hxx-epilogue '\\\#include "contacts-custom.hxx"' + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/double/README b/examples/cxx/tree/custom/double/README new file mode 100644 index 0000000..15348d2 --- /dev/null +++ b/examples/cxx/tree/custom/double/README @@ -0,0 +1,62 @@ +This example shows how to customize parsing and serialization code for the +xsd:double XML Schema built-in type using the type customization mechanism +provided by the C++/Tree Mapping. For more information on type customization +see the C++/Tree Mapping Customization Guide, particularly sections 1 and 4: + +http://wiki.codesynthesis.com/Tree/Customization_guide + +In this example our schema uses xsd:double to represent a price. There are +two potential problems with this choice of a price type. First, xsd:double +can be serialized in the scientific notation which would be an unusual way +of representing a price. Second, we would like to limit the number of +fraction digits in our prices to 2. Furthermore, we would like to always +have two fraction digits, even if one or both of them are zeros, for +example: 12.99, 12.90, 12.00. + +In case we can modify the schema, a better approach would be to define the +price type as a restriction of the xsd:decimal type (always fixed notation) +and specify the fractionDigits facet to limit the number of fraction digits +to 2. However, there is no way in XML Schema to specify that there should +always be exactly 2 fraction digits. Therefore, it may still be desirable +to customize this price type to get the required serialization behavior. + +Finally, it is worth noting that the behavior achieved in this example via +type customization can also be achieved by compiling your code with the +following macros defined: + +XSD_TREE_DOUBLE_FIXED +XSD_TREE_DOUBLE_PRECISION 2 + +However, the type customization approach while requiring more work is +cleaner since it does not rely on global macro definitions. + +This example consists of the following files: + +order.xsd + XML Schema definition for a simple order vocabulary. + +double-custom.hxx +double-custom.cxx + Custom parsing and serialization code for the xsd:double types. The + double-custom.hxx file is included at the end of the xml-schema.hxx + file described below. + +xml-schema.hxx + C++ types for XML Schema built-in types. This header file is generated + by the XSD compiler using the --generate-xml-schema option. The + --custom-type option is used to customize the xsd:double type. The + --hxx-epilogue option is used to include the double-custom.hxx file + at the end of this file. + +order.hxx +order.cxx + C++ types generated from order.xsd. The --extern-xml-schema option + is used to include xml-schema.hxx into order.hxx. + +driver.cxx + Test driver for the example. It creates a sample order and then + writes it to XML to test the custom xsd:double serialization code. + +To run the example simply execute: + +$ ./driver diff --git a/examples/cxx/tree/custom/double/double-custom.cxx b/examples/cxx/tree/custom/double/double-custom.cxx new file mode 100644 index 0000000..78904a0 --- /dev/null +++ b/examples/cxx/tree/custom/double/double-custom.cxx @@ -0,0 +1,97 @@ +// file : examples/cxx/tree/custom/double/double-custom.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Include xml-schema.hxx instead of double-custom.hxx here. +// +#include "xml-schema.hxx" + +#include +#include +#include + +#include +#include + +using namespace std; + +// Parsing. +// +namespace xsd +{ + namespace cxx + { + namespace tree + { + double traits:: + create (const std::string& s, + const xercesc::DOMElement*, + flags, + type*) + { + // This type cannot have whitespaces in its values. As result we + // don't need to waste time collapsing whitespaces. All we need to + // do is trim the string representation which can be done without + // copying. + // + ro_string tmp (s); + trim (tmp); + + zc_istream is (tmp); + is.imbue (locale::classic ()); + + double t; + is >> t; + + return t; + } + } + } +} + +// Serialization. +// +namespace XERCES_CPP_NAMESPACE +{ + void + operator<< (xercesc::DOMElement& e, const xml_schema::as_double& d) + { + ostringstream os; + os.imbue (locale::classic ()); + + os.precision (2); + os << fixed << d.x; + + e << os.str (); + } + + void + operator<< (xercesc::DOMAttr& a, const xml_schema::as_double& d) + { + ostringstream os; + os.imbue (locale::classic ()); + + os.precision (2); + os << fixed << d.x; + + a << os.str (); + } +} + +namespace xsd +{ + namespace cxx + { + namespace tree + { + void + operator<< (xml_schema::list_stream& ls, + const xml_schema::as_double& d) + { + ls.os_.imbue (locale::classic ()); + ls.os_.precision (2); + ls.os_ << fixed << d.x; + } + } + } +} diff --git a/examples/cxx/tree/custom/double/double-custom.hxx b/examples/cxx/tree/custom/double/double-custom.hxx new file mode 100644 index 0000000..17d9a44 --- /dev/null +++ b/examples/cxx/tree/custom/double/double-custom.hxx @@ -0,0 +1,68 @@ +// file : examples/cxx/tree/custom/double/double-custom.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use xml-schema.hxx instead. This +// file is included into generated xml-schema.hxx so we do not need to +// guard against multiple inclusions. +// + +#include // xml::transcode +#include // text_content + +// Parsing. +// +namespace xsd +{ + namespace cxx + { + namespace tree + { + template<> + struct traits + { + static double + create (const xercesc::DOMElement& e, flags f, type* c) + { + return create (text_content (e), 0, f, c); + } + + static double + create (const xercesc::DOMAttr& a, flags f, type* c) + { + return create (xml::transcode (a.getValue ()), 0, f, c); + } + + static double + create (const std::string& s, + const xercesc::DOMElement*, + flags, + type*); + }; + } + } +} + +// Serialization. +// +namespace XERCES_CPP_NAMESPACE +{ + void + operator<< (xercesc::DOMElement& e, const xml_schema::as_double& d); + + void + operator<< (xercesc::DOMAttr& a, const xml_schema::as_double& d); +} + +namespace xsd +{ + namespace cxx + { + namespace tree + { + void + operator<< (xml_schema::list_stream& ls, + const xml_schema::as_double& d); + } + } +} diff --git a/examples/cxx/tree/custom/double/driver.cxx b/examples/cxx/tree/custom/double/driver.cxx new file mode 100644 index 0000000..2e5b44d --- /dev/null +++ b/examples/cxx/tree/custom/double/driver.cxx @@ -0,0 +1,32 @@ +// file : examples/cxx/tree/custom/double/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include + +#include "order.hxx" + +using std::cerr; +using std::endl; + +int +main () +{ + try + { + // Order one Airbus A380. + // + order o; + o.item ().push_back (item ("Airbus A380", 317000000.90)); + + + // Serialize. + // + order_ (std::cout, o); + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/custom/double/makefile b/examples/cxx/tree/custom/double/makefile new file mode 100644 index 0000000..249ed01 --- /dev/null +++ b/examples/cxx/tree/custom/double/makefile @@ -0,0 +1,79 @@ +# file : examples/cxx/tree/custom/double/makefile +# author : Boris Kolpackov +# 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 := order.xsd +cxx := driver.cxx double-custom.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/xml-schema.hxx: $(out_root)/xsd/xsd + $(call message,xsd $(src_base)/xml-schema.xsd,\ +$(out_root)/xsd/xsd cxx-tree --output-dir $(out_base) --generate-xml-schema \ +--generate-serialization --custom-type double=double \ +--hxx-epilogue '\#include "double-custom.hxx"' xml-schema.xsd) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-serialization --extern-xml-schema xml-schema.xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# 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) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/double/order.xsd b/examples/cxx/tree/custom/double/order.xsd new file mode 100644 index 0000000..0d7fe05 --- /dev/null +++ b/examples/cxx/tree/custom/double/order.xsd @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/custom/makefile b/examples/cxx/tree/custom/makefile new file mode 100644 index 0000000..c29fd03 --- /dev/null +++ b/examples/cxx/tree/custom/makefile @@ -0,0 +1,22 @@ +# file : examples/cxx/tree/custom/makefile +# author : Boris Kolpackov +# 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 + +examples := comments contacts double taxonomy wildcard + +ifeq ($(xsd_with_boost_date_time),y) +examples += calendar +endif + +default := $(out_base)/ +clean := $(out_base)/.clean + +.PHONY: $(default) $(clean) + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(examples))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(examples))) + +$(foreach e,$(examples),$(call import,$(src_base)/$e/makefile)) diff --git a/examples/cxx/tree/custom/taxonomy/README b/examples/cxx/tree/custom/taxonomy/README new file mode 100644 index 0000000..addce83 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/README @@ -0,0 +1,50 @@ +This example shows how to map user-defined XML Schema types to custom C++ +classes. It presents the complex case where the customized types are +inherited from in the same schema. For the simple case see the contacts +example. For more information on the C++/Tree mapping customization see +the C++/Tree Mapping Customization Guide[1]. + +[1] http://wiki.codesynthesis.com/Tree/Customization_guide + +The example consists of the following files: + +people.xsd + XML Schema definition for a simple people database. + +people.xml + Sample XML instance document. + +people-fwd.hxx +people.hxx +people.ixx +people.cxx + C++ types that represent the given vocabulary and a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model. These are generated by XSD from people.xsd with the + --custom-type option in order to to customize the person, superman, + and batman types. Generation of the people-fwd.hxx forward declaration + file is requested with the --generate-forward option. + +people-custom-fwd.hxx + Header file which forward-declares our own person, superman, and batman + as class templates. It is included at the beginning of people-fwd.hxx + using the --fwd-prologue option. + +people-custom.hxx + Header file which defines our own person, superman, and batman class + templates by inheriting from the generated person_base, superman_base, + and batman_base. It is included at the beginning of people.hxx using + the --hxx-prologue option. + +people-custom.cxx + Source file which contains the implementations and instantiations of + our person, superman, and batman class templates. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the database to STDERR. + +To run the example on the sample XML instance document simply execute: + +$ ./driver people.xml diff --git a/examples/cxx/tree/custom/taxonomy/driver.cxx b/examples/cxx/tree/custom/taxonomy/driver.cxx new file mode 100644 index 0000000..f102fc3 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/driver.cxx @@ -0,0 +1,39 @@ +// file : examples/cxx/tree/custom/taxonomy/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "people.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " people.xml" << endl; + return 1; + } + + try + { + using namespace people; + + std::auto_ptr c (catalog_ (argv[1])); + + for (catalog::person_const_iterator i (c->person ().begin ()); + i != c->person ().end (); ++i) + { + i->print (cerr); + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/custom/taxonomy/makefile b/examples/cxx/tree/custom/taxonomy/makefile new file mode 100644 index 0000000..a5fa4a3 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/makefile @@ -0,0 +1,82 @@ +# file : examples/cxx/tree/custom/taxonomy/makefile +# author : Boris Kolpackov +# 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 := people.xsd +cxx := driver.cxx people-custom.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +# We have to double-escape '#' because the message function +# (which is used in command scripts) expands things twice. +# +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-inline \ +--generate-forward \ +--generate-polymorphic \ +--custom-type "person=person_impl/person_base" \ +--custom-type "superman=superman_impl/superman_base" \ +--custom-type "batman=batman_impl/batman_base" \ +--fwd-prologue '\\\#include "people-custom-fwd.hxx"' \ +--hxx-prologue '\\\#include "people-custom.hxx"' + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/taxonomy/people-custom-fwd.hxx b/examples/cxx/tree/custom/taxonomy/people-custom-fwd.hxx new file mode 100644 index 0000000..973b6e5 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/people-custom-fwd.hxx @@ -0,0 +1,20 @@ +// file : examples/cxx/tree/custom/taxonomy/people-custom-fwd.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use people-fwd.hxx instead. This +// file is included into generated people-fwd.hxx so we do not need to +// guard against multiple inclusions. +// + +namespace people +{ + template + class person_impl; + + template + class superman_impl; + + template + class batman_impl; +} diff --git a/examples/cxx/tree/custom/taxonomy/people-custom.cxx b/examples/cxx/tree/custom/taxonomy/people-custom.cxx new file mode 100644 index 0000000..14c7087 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/people-custom.cxx @@ -0,0 +1,180 @@ +// file : examples/cxx/tree/custom/taxonomy/people-custom.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include + +// Include people.hxx instead of people-custom.hxx here. +// +#include "people.hxx" + +namespace people +{ + // person_impl + // + template + person_impl:: + person_impl (const xml_schema::string& name) + : base (name) + { + } + + template + person_impl:: + person_impl (std::auto_ptr& name) + : base (name) + { + } + + template + person_impl:: + person_impl (const xercesc::DOMElement& e, + xml_schema::flags f, + xml_schema::container* c) + : base (e, f, c) + { + } + + template + person_impl:: + person_impl (const person_impl& p, + xml_schema::flags f, + xml_schema::container* c) + : base (p, f, c) + { + } + + template + person_impl* person_impl:: + _clone (xml_schema::flags f, xml_schema::container* c) const + { + return new person_impl (*this, f, c); + } + + template + void person_impl:: + print (std::ostream& os) const + { + os << this->name () << std::endl; + } + + // Explicitly instantiate person_impl class template for person_base. + // + template class person_impl; + + + // superman_impl + // + template + superman_impl:: + superman_impl (const xml_schema::string& name, bool can_fly) + : base (name, can_fly) + { + } + + template + superman_impl:: + superman_impl (std::auto_ptr& name, bool can_fly) + : base (name, can_fly) + { + } + + template + superman_impl:: + superman_impl (const xercesc::DOMElement& e, + xml_schema::flags f, + xml_schema::container* c) + : base (e, f, c) + { + } + + template + superman_impl:: + superman_impl (const superman_impl& s, + xml_schema::flags f, + xml_schema::container* c) + : base (s, f, c) + { + } + + template + superman_impl* superman_impl:: + _clone (xml_schema::flags f, xml_schema::container* c) const + { + return new superman_impl (*this, f, c); + } + + template + void superman_impl:: + print (std::ostream& os) const + { + if (this->can_fly ()) + os << "Flying superman "; + else + os << "Superman "; + + os << this->name () << std::endl; + } + + // Explicitly instantiate superman_impl class template for superman_base. + // + template class superman_impl; + + + // batman_impl + // + template + batman_impl:: + batman_impl (const xml_schema::string& name, + bool can_fly, + unsigned int wing_span) + : base (name, can_fly, wing_span) + { + } + + template + batman_impl:: + batman_impl (std::auto_ptr& name, + bool can_fly, + unsigned int wing_span) + : base (name, can_fly, wing_span) + { + } + + template + batman_impl:: + batman_impl (const xercesc::DOMElement& e, + xml_schema::flags f, + xml_schema::container* c) + : base (e, f, c) + { + } + + template + batman_impl:: + batman_impl (const batman_impl& s, + xml_schema::flags f, + xml_schema::container* c) + : base (s, f, c) + { + } + + template + batman_impl* batman_impl:: + _clone (xml_schema::flags f, xml_schema::container* c) const + { + return new batman_impl (*this, f, c); + } + + template + void batman_impl:: + print (std::ostream& os) const + { + os << "Batman " << this->name () << " with " << + this->wing_span () << "m wing span" << std::endl; + } + + // Explicitly instantiate batman_impl class template for batman_base. + // + template class batman_impl; +} diff --git a/examples/cxx/tree/custom/taxonomy/people-custom.hxx b/examples/cxx/tree/custom/taxonomy/people-custom.hxx new file mode 100644 index 0000000..23e7731 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/people-custom.hxx @@ -0,0 +1,103 @@ +// file : examples/cxx/tree/custom/taxonomy/people-custom.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use people.hxx instead. This +// file is included into generated people.hxx so we do not need to +// guard against multiple inclusions. +// + +#include // std::ostream + +// Include people-fwd.hxx here so that we can refer to the generated +// types. +// +#include "people-fwd.hxx" + +namespace people +{ + // + // + template + class person_impl: public base + { + public: + person_impl (const xml_schema::string& name); + person_impl (std::auto_ptr& name); + + person_impl (const xercesc::DOMElement&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + person_impl (const person_impl&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + virtual person_impl* + _clone (xml_schema::flags = 0, + xml_schema::container* = 0) const; + + public: + virtual void + print (std::ostream&) const; + }; + + + // + // + template + class superman_impl: public base + { + public: + superman_impl (const xml_schema::string& name, bool can_fly); + superman_impl (std::auto_ptr& name, bool can_fly); + + superman_impl (const xercesc::DOMElement&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + superman_impl (const superman_impl&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + virtual superman_impl* + _clone (xml_schema::flags = 0, + xml_schema::container* = 0) const; + + public: + virtual void + print (std::ostream&) const; + }; + + + // + // + template + class batman_impl: public base + { + public: + batman_impl (const xml_schema::string& name, + bool can_fly, + unsigned int wing_span); + + batman_impl (std::auto_ptr& name, + bool can_fly, + unsigned int wing_span); + + batman_impl (const xercesc::DOMElement&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + batman_impl (const batman_impl&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + virtual batman_impl* + _clone (xml_schema::flags = 0, + xml_schema::container* = 0) const; + + public: + virtual void + print (std::ostream&) const; + }; +} diff --git a/examples/cxx/tree/custom/taxonomy/people.xml b/examples/cxx/tree/custom/taxonomy/people.xml new file mode 100644 index 0000000..5f84855 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/people.xml @@ -0,0 +1,27 @@ + + + + + + + + Joe Dirt + + + + James "007" Bond + + + + Bruce Wayne + + + diff --git a/examples/cxx/tree/custom/taxonomy/people.xsd b/examples/cxx/tree/custom/taxonomy/people.xsd new file mode 100644 index 0000000..c77a866 --- /dev/null +++ b/examples/cxx/tree/custom/taxonomy/people.xsd @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/custom/wildcard/README b/examples/cxx/tree/custom/wildcard/README new file mode 100644 index 0000000..5ca25c0 --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/README @@ -0,0 +1,45 @@ +This example shows how to use type customization to parse and serialize +a specific attribute that is matched by a wildcard (anyAttribute). The +example achieves this by customizing the type to include the data +members and accessors/modifiers that represent the attribute as well as +the parsing constructor and serialization operator where the attribute +value is extracted from and inserted back to DOM, respectively. For +more information on the C++/Tree mapping customization see the C++/Tree +Mapping Customization Guide[1]. + +[1] http://wiki.codesynthesis.com/Tree/Customization_guide + +The example consists of the following files: + +wildcard.xsd + XML Schema definition for simple data type and element. + +contacts.xml + Sample XML instance document. + +wildcard.hxx +wildcard.ixx +wildcard.cxx + C++ types that represent the given vocabulary, a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model, and a set of serialization functions that convert the + object model back to XML. These are generated by XSD from wildcard.xsd + with the --custom-type option in order to to customize the data type. + +wildcard-custom.hxx + Header file which defines our own data class by inheriting from the + generated data_base. It is included at the end of wildcard.hxx using + the --hxx-epilogue option. + +wildcard-custom.cxx + Source file which contains the implementation of our data class. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the data to STDERR, including the extra attribute. Finally, the driver + serializes the object model back to XML. + +To run the example on the sample XML instance document simply execute: + +$ ./driver wildcard.xml diff --git a/examples/cxx/tree/custom/wildcard/driver.cxx b/examples/cxx/tree/custom/wildcard/driver.cxx new file mode 100644 index 0000000..d63fb11 --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/driver.cxx @@ -0,0 +1,48 @@ +// file : examples/cxx/tree/custom/wildcard/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "wildcard.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " wildcard.xml" << endl; + return 1; + } + + try + { + using namespace wildcard; + + // Parse. + // + std::auto_ptr d (data_ (argv[1])); + + // Print. + // + cerr << *d << endl; + + // Serialize. + // + xml_schema::namespace_infomap map; + + map["wc"].name = "http://www.codesynthesis.com/wildcard"; + map["wc"].schema = "wildcard.xsd"; + + data_ (std::cout, *d, map); + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/custom/wildcard/makefile b/examples/cxx/tree/custom/wildcard/makefile new file mode 100644 index 0000000..87f95ea --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/makefile @@ -0,0 +1,79 @@ +# file : examples/cxx/tree/custom/wildcard/makefile +# author : Boris Kolpackov +# 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 := wildcard.xsd +cxx := driver.cxx wildcard-custom.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +# We have to double-escape '#' because the message function +# (which is used in command scripts) expands things twice. +# +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-inline \ +--generate-ostream \ +--generate-serialization \ +--custom-type data=/data_base \ +--hxx-epilogue '\\\#include "wildcard-custom.hxx"' + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/custom/wildcard/wildcard-custom.cxx b/examples/cxx/tree/custom/wildcard/wildcard-custom.cxx new file mode 100644 index 0000000..422a4b3 --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/wildcard-custom.cxx @@ -0,0 +1,85 @@ +// file : examples/cxx/tree/custom/wildcard/wildcard-custom.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include + +// Include wildcard.hxx instead of wildcard-custom.hxx here. +// +#include "wildcard.hxx" + +namespace wildcard +{ + data:: + data (const xml_schema::string& d) + : data_base (d), scope_present_ (false) + { + } + + data:: + data (const xercesc::DOMElement& e, + xml_schema::flags f, + xml_schema::container* c) + : data_base (e, f, c), scope_present_ (false) + { + // Check if we've got the scope attribute. + // + namespace xml = xsd::cxx::xml; + xml::string name ("scope"); + + if (e.hasAttribute (name.c_str ())) + { + scope (xml::transcode (e.getAttribute (name.c_str ()))); + } + } + + data:: + data (const data& d, + xml_schema::flags f, + xml_schema::container* c) + : data_base (d, f, c), + scope_present_ (d.scope_present_), + scope_ (d.scope_) + { + } + + data* data:: + _clone (xml_schema::flags f, xml_schema::container* c) const + { + return new data (*this, f, c); + } + + void + operator<< (xercesc::DOMElement& e, const data& x) + { + // Use our base to serialize data and id. + // + const data_base& b (x); + e << b; + + // Add the scope attribute if present. + // + if (x.scope_present ()) + { + namespace xml = xsd::cxx::xml; + xml::string name ("scope"); + xml::string value (x.scope ()); + + e.setAttribute (name.c_str (), value.c_str ()); + } + } + + std::ostream& + operator<< (std::ostream& os, const data& x) + { + // Use our base to print date and id. + // + const data_base& b (x); + os << b; + + if (x.scope_present ()) + os << std::endl << "scope: " << x.scope (); + + return os; + } +} diff --git a/examples/cxx/tree/custom/wildcard/wildcard-custom.hxx b/examples/cxx/tree/custom/wildcard/wildcard-custom.hxx new file mode 100644 index 0000000..2c58cc8 --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/wildcard-custom.hxx @@ -0,0 +1,67 @@ +// file : examples/cxx/tree/custom/wildcard/wildcard-custom.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +// Do not include this file directly, use wildcard.hxx instead. This +// file is included into generated wildcard.hxx so we do not need to +// guard against multiple inclusions. +// + +namespace wildcard +{ + class data: public data_base + { + // Standard constructors. + // + public: + data (const xml_schema::string&); + + data (const xercesc::DOMElement&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + data (const data&, + xml_schema::flags = 0, + xml_schema::container* = 0); + + virtual data* + _clone (xml_schema::flags = 0, + xml_schema::container* = 0) const; + + // Our customizations. + // + public: + bool + scope_present () const + { + return scope_present_; + } + + const xml_schema::string& + scope () const + { + return scope_; + } + + void + scope (const xml_schema::string& s) + { + scope_present_ = true; + scope_ = s; + } + + private: + bool scope_present_; + xml_schema::string scope_; + }; + + // Serialization operator. + // + void + operator<< (xercesc::DOMElement&, const data&); + + // std::ostream insertion operator. + // + std::ostream& + operator<< (std::ostream&, const data&); +} diff --git a/examples/cxx/tree/custom/wildcard/wildcard.xml b/examples/cxx/tree/custom/wildcard/wildcard.xml new file mode 100644 index 0000000..c980193 --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/wildcard.xml @@ -0,0 +1,15 @@ + + + + +abc123 diff --git a/examples/cxx/tree/custom/wildcard/wildcard.xsd b/examples/cxx/tree/custom/wildcard/wildcard.xsd new file mode 100644 index 0000000..ccce30b --- /dev/null +++ b/examples/cxx/tree/custom/wildcard/wildcard.xsd @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/dbxml/README b/examples/cxx/tree/dbxml/README new file mode 100644 index 0000000..59e67d0 --- /dev/null +++ b/examples/cxx/tree/dbxml/README @@ -0,0 +1,45 @@ +This example shows how to use the C++/Tree mapping on top of the Berkeley +DB XML embedded XML database. This example is described in detail in the +"C++/Tree Mapping and Berkeley DB XML Integration Guide" which can be +found in the documentation/cxx/tree/dbxml directory of the XSD +distribution. + +You will need the Berkeley DB XML libraries[1] installed in order to build +and run this example. The makefiles and project files for this example link +to the DB XML library names corresponding to version 2.3.X. Earlier and later +versions can also be used but may require adjustments to the library names +being linked to. + +Note that due to the incomplete DOM API implementation provided by DB +XML (as of version 2.3.10), the generated code and your application +should be compiled with the DBXML_DOM macro defined in order to avoid +using unsupported parts of the API. + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.hxx +library.cxx + C++ types that represent the given vocabulary, a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model, and a set of serialization functions that convert the + object model back to XML. These are generated by XSD from library.xsd. + +driver.cxx + Driver for the example. It performs the following four operations on + the database: + + * Create a new document in DB from an object model + * Create an object model from a document in DB + * Create an object model from a document fragment in DB + * Update a document fragment in DB from an object model + + +To run the example simply execute: + +$ ./driver + + +[1] http://www.sleepycat.com/products/bdbxml.html diff --git a/examples/cxx/tree/dbxml/driver.cxx b/examples/cxx/tree/dbxml/driver.cxx new file mode 100644 index 0000000..56cbb4a --- /dev/null +++ b/examples/cxx/tree/dbxml/driver.cxx @@ -0,0 +1,175 @@ +// file : examples/cxx/tree/dbxml/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include +#include + +#include + +#include "library.hxx" + +using std::cerr; +using std::endl; +using std::string; +using std::auto_ptr; + +using namespace DbXml; +using namespace xsd::cxx; // for xml::string + +void +print_document (const string& desc, + XmlContainer container, + const string& name) +{ + XmlDocument doc (container.getDocument (name)); + + string content; + doc.getContent (content); + + cerr << endl + << desc << endl + << content << endl; +} + +int +main () +{ + try + { + using namespace library; + using xml_schema::date; + + XmlManager manager; + + { + XmlContainer container (manager.createContainer ("new.bdbxml")); + + XmlUpdateContext update_context (manager.createUpdateContext ()); + + XmlQueryContext context (manager.createQueryContext ()); + context.setNamespace ("lib", "http://www.codesynthesis.com/library"); + + + // Create a new document from an object model. + // + { + // Create a new catalog with one book. + // + catalog c; + + book b (20530902, // ISBN + "The Elements of Style", // Title + genre::reference, // Genre + "ES"); // ID + + author strunk ("William Strunk, Jr.", date (1869, 7, 1)); + strunk.died (date (1946, 9, 26)); + + b.author ().push_back (strunk); + c.book ().push_back (b); + + + // Create a new XML document. + // + XmlDocument doc (manager.createDocument ()); + doc.setName ("new.xml"); + + + // Obtain its DOM representation and add the root element. + // + xercesc::DOMDocument& dom_doc (*doc.getContentAsDOM ()); + + dom_doc.appendChild ( + dom_doc.createElementNS ( + xml::string ("http://www.codesynthesis.com/library").c_str (), + xml::string ("lib:catalog").c_str ())); + + + // Serialize the object model to the XML document. Also avoid + // re-initializing the Xerces-C++ runtime since XmlManager has + // it initialized. + // + catalog_ (dom_doc, c, xml_schema::flags::dont_initialize); + + + // Place the document into the container. + // + container.putDocument (doc, update_context); + + print_document ("after create:", container, "new.xml"); + } + + // Create an object model from a document in DB. + // + { + // Resolve the document in the container. + // + XmlDocument doc (container.getDocument ("new.xml")); + + + // Create the object model from the document's DOM. Also avoid + // re-initializing the Xerces-C++ runtime since XmlManager has + // it initialized. + // + auto_ptr c (catalog_ (*doc.getContentAsDOM (), + xml_schema::flags::dont_initialize)); + + cerr << *c << endl; + } + + + // Lookup a document fragment. + // + + string query ("collection('new.bdbxml')/lib:catalog/book[@id='ES']"); + + // Find "The Elements of Style". + // + XmlValue v; + XmlResults results (manager.query (query, context)); + + if (results.next (v)) + { + // Create an object model from the document fragment. + // + auto_ptr b ( + new book ( + *static_cast (v.asNode ()))); + + cerr << *b << endl; + + + // Add another author, change the availability status. + // + author white ("E.B. White", date (1899, 7, 11)); + white.died (date (1985, 10, 1)); + + b->author ().push_back (white); + b->available (false); + + + // Update the document fragment from the object model. + // + *static_cast (v.asNode ()) << *b; + + + // Update the document in the container. + // + XmlDocument doc (v.asDocument ()); + container.updateDocument (doc, update_context); + } + + print_document ("after update:", container, "new.xml"); + } + + manager.removeContainer ("new.bdbxml"); + } + catch (const std::exception& e) + { + cerr << e.what () << endl; + return 1; + } +} diff --git a/examples/cxx/tree/dbxml/library.xsd b/examples/cxx/tree/dbxml/library.xsd new file mode 100644 index 0000000..c71c312 --- /dev/null +++ b/examples/cxx/tree/dbxml/library.xsd @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/dbxml/makefile b/examples/cxx/tree/dbxml/makefile new file mode 100644 index 0000000..2a5ba4e --- /dev/null +++ b/examples/cxx/tree/dbxml/makefile @@ -0,0 +1,76 @@ +# file : examples/cxx/tree/dbxml/makefile +# author : Boris Kolpackov +# 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 := library.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libdbxml/stub.make,\ + l: dbxml.l,cpp-options: dbxml.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) $(dbxml.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd -DDBXML_DOM +$(obj) $(dep): $(xerces_c.l.cpp-options) $(dbxml.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --generate-serialization \ + --generate-ostream + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/hello/README b/examples/cxx/tree/hello/README new file mode 100644 index 0000000..bb98584 --- /dev/null +++ b/examples/cxx/tree/hello/README @@ -0,0 +1,26 @@ +This is a "Hello, world!" example that shows how to use the C++/Tree +mapping to access XML instance documents described by XML Schema +definitions. + +The example consists of the following files: + +hello.xsd + XML Schema which describes "hello" instance documents. + +hello.xml + Sample XML instance document. + +hello.hxx +hello.cxx + C++ types that represent the given vocabulary and a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model. These are generated by XSD from hello.xsd. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the content of the object model to STDERR. + +To run the example on the sample XML instance document simply execute: + +$ ./driver hello.xml diff --git a/examples/cxx/tree/hello/driver.cxx b/examples/cxx/tree/hello/driver.cxx new file mode 100644 index 0000000..6ea6823 --- /dev/null +++ b/examples/cxx/tree/hello/driver.cxx @@ -0,0 +1,37 @@ +// file : examples/cxx/tree/hello/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "hello.hxx" + +using namespace std; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " hello.xml" << endl; + return 1; + } + + try + { + auto_ptr h (hello (argv[1])); + + for (hello_t::name_const_iterator i (h->name ().begin ()); + i != h->name ().end (); + ++i) + { + cout << h->greeting () << ", " << *i << "!" << endl; + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/hello/hello.xml b/examples/cxx/tree/hello/hello.xml new file mode 100644 index 0000000..bcde610 --- /dev/null +++ b/examples/cxx/tree/hello/hello.xml @@ -0,0 +1,20 @@ + + + + + + + Hello + + sun + moon + world + + diff --git a/examples/cxx/tree/hello/hello.xsd b/examples/cxx/tree/hello/hello.xsd new file mode 100644 index 0000000..e8f5147 --- /dev/null +++ b/examples/cxx/tree/hello/hello.xsd @@ -0,0 +1,53 @@ + + + + + + + + + + + The hello_t type consists of a greeting phrase and a + collection of names to which this greeting applies. + + + + + + + + + The greeting element contains the greeting phrase + for this hello object. + + + + + + + + The name elements contains names to be greeted. + + + + + + + + + + + The hello element is a root of the Hello XML vocabulary. + Every conforming document should start with this element. + + + + + diff --git a/examples/cxx/tree/hello/makefile b/examples/cxx/tree/hello/makefile new file mode 100644 index 0000000..95288f5 --- /dev/null +++ b/examples/cxx/tree/hello/makefile @@ -0,0 +1,71 @@ +# file : examples/cxx/tree/hello/makefile +# author : Boris Kolpackov +# 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 := hello.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/library/README b/examples/cxx/tree/library/README new file mode 100644 index 0000000..960d1d4 --- /dev/null +++ b/examples/cxx/tree/library/README @@ -0,0 +1,32 @@ +This example shows how to use the C++/Tree mapping to parse XML documents +into a tree-like in-memory object model, modify this object model, and +finally serialize it back to XML. + +The example consists of the following files: + +library.xsd + XML Schema which describes a library of books. + +library.xml + Sample XML instance document. + +library.hxx +library.ixx +library.cxx + C++ types that represent the given vocabulary, a set of parsing + functions that convert XML documents to a tree-like in-memory object + model, and a set of serialization functions that convert the object + model back to XML. These are generated by XSD from library.xsd. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the content of the object model to STDERR. Finally, the driver modifies + the object model and serializes it back to XML. + +To run the example on the sample XML instance document simply execute: + +$ ./driver library.xml + +This example also shows how to to use the ID/IDREF cross-referencing +mechanism and the xsd:enumeration to C++ enum mapping. diff --git a/examples/cxx/tree/library/driver.cxx b/examples/cxx/tree/library/driver.cxx new file mode 100644 index 0000000..ae68b87 --- /dev/null +++ b/examples/cxx/tree/library/driver.cxx @@ -0,0 +1,131 @@ +// file : examples/cxx/tree/library/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "library.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " library.xml" << endl; + return 1; + } + + try + { + using namespace library; + + // Read in the XML file and obtain its object model. + // + std::auto_ptr c (catalog_ (argv[1])); + + + // Let's print what we've got. + // + for (catalog::book_const_iterator bi (c->book ().begin ()); + bi != c->book ().end (); + ++bi) + { + cerr << endl + << "ID : " << bi->id () << endl + << "ISBN : " << bi->isbn () << endl + << "Title : " << bi->title () << endl + << "Genre : " << bi->genre () << endl; + + for (book::author_const_iterator ai (bi->author ().begin ()); + ai != bi->author ().end (); + ++ai) + { + cerr << "Author : " << ai->name () << endl; + cerr << " Born : " << ai->born () << endl; + + if (ai->died ()) + cerr << " Died : " << *ai->died () << endl; + + if (ai->recommends ()) + cerr << " Recommends : " << (*ai->recommends ())->title () << endl; + } + + cerr << "Available : " << std::boolalpha << bi->available () << endl; + } + + + // Now we are going to modify the object model and serialize it + // back to XML. + // + + catalog::book_sequence& books (c->book ()); + + + // Get rid of all unavailable books. + // + for (catalog::book_iterator bi (books.begin ()); bi != books.end ();) + { + if (!bi->available ()) + bi = books.erase (bi); + else + ++bi; + } + + + // Insert a new book. + // + book b (679776443, // ISBN + "Dead Souls", // Title + genre::philosophy, // Genre + "DS"); // ID + + b.author ().push_back (author ("Nikolai Gogol", + xml_schema::date (1809, 3, 31))); + + books.insert (books.begin (), b); + + + // Because we removed all unavailable books, some IDREFs might be + // broken. Let's fix this. + // + for (catalog::book_iterator bi (books.begin ()); bi != books.end (); ++bi) + { + for (book::author_iterator ai (bi->author ().begin ()); + ai != bi->author ().end (); + ++ai) + { + author::recommends_optional& c (ai->recommends ()); + + if (c.present ()) + { + author::recommends_type& ref (c.get ()); + + if (!ref) + c.reset (); + } + } + } + + + // Prepare namespace mapping and schema location information. + // + xml_schema::namespace_infomap map; + + map["lib"].name = "http://www.codesynthesis.com/library"; + map["lib"].schema = "library.xsd"; + + + // Write it out. + // + catalog_ (std::cout, *c, map); + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/library/library.xml b/examples/cxx/tree/library/library.xml new file mode 100644 index 0000000..e9acb75 --- /dev/null +++ b/examples/cxx/tree/library/library.xml @@ -0,0 +1,53 @@ + + + + + + + + 0679760806 + The Master and Margarita + fiction + + + Mikhail Bulgakov + 1891-05-15 + 1940-03-10 + + + + + + 0679600841 + War and Peace + history + + + Leo Tolstoy + 1828-09-09 + 1910-11-20 + + + + + + 0679420290 + Crime and Punishment + philosophy + + + Fyodor Dostoevsky + 1821-11-11 + 1881-02-09 + + + + diff --git a/examples/cxx/tree/library/library.xsd b/examples/cxx/tree/library/library.xsd new file mode 100644 index 0000000..baf2221 --- /dev/null +++ b/examples/cxx/tree/library/library.xsd @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/library/makefile b/examples/cxx/tree/library/makefile new file mode 100644 index 0000000..ceecbb2 --- /dev/null +++ b/examples/cxx/tree/library/makefile @@ -0,0 +1,73 @@ +# file : examples/cxx/tree/library/makefile +# author : Boris Kolpackov +# 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 := library.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --generate-inline \ + --generate-ostream \ + --generate-serialization + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/makefile b/examples/cxx/tree/makefile new file mode 100644 index 0000000..7866b33 --- /dev/null +++ b/examples/cxx/tree/makefile @@ -0,0 +1,27 @@ +# file : examples/cxx/tree/makefile +# author : Boris Kolpackov +# 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 + +examples := binary caching custom hello library messaging mixed multiroot \ +performance polymorphism streaming wildcard + +ifeq ($(xsd_with_dbxml),y) +examples += dbxml +endif + +ifeq ($(xsd_with_xqilla),y) +examples += xpath +endif + +default := $(out_base)/ +clean := $(out_base)/.clean + +.PHONY: $(default) $(clean) + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(examples))) +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(examples))) + +$(foreach e,$(examples),$(call import,$(src_base)/$e/makefile)) diff --git a/examples/cxx/tree/messaging/README b/examples/cxx/tree/messaging/README new file mode 100644 index 0000000..435a4cf --- /dev/null +++ b/examples/cxx/tree/messaging/README @@ -0,0 +1,58 @@ +This example shows how to handle XML vocabularies with multiple +root elements using the element type and element map features +of the C++/Tree mapping. The main purpose of element types is +to distinguish object models with the same root type but with +different root elements. The element map allows uniform parsing +and serialization of multiple root elements. + +The example consists of the following files: + +protocol.xsd + XML Schema which defines a simple bank account protocol with + requests such as withdraw and deposit. Note that some request + and response elements are of the same type. + +balance.xml +withdraw.xml +deposit.xml + Sample XML instances for the protocol requests. + +protocol.hxx +protocol.cxx + C++ types that represent the given vocabulary. These are + generated by the XSD compiler from protocol.xsd. Generation of + element types instead of parsing and serialization functions is + requested with the --generate-element-type option. Generation of + the element map is requested with the --generate-element-map + option. + +dom-parse.hxx +dom-parse.cxx + Definition and implementation of the parse() function that + parses an XML document to a DOM document. + +dom-serialize.hxx +dom-serialize.cxx + Definition and implementation of the serialize() function that + serializes a DOM document to XML. + +driver.cxx + Driver for the example. It first calls the above-mentioned parse() + function to parse the input file to a DOM document. It then calls + the parse() function on the element map to parse the root document + element to the object model. The object model is returned as a + pointer to xml_schema::element_type which is a common base type for + all element types. The driver then determines which request it has + received either using RTTI or by comparing the root element names. + Once the request type is determined, information about it is printed + to STDERR and the corresponding response is created. Finally, the + driver serializes the opaque response object to a DOM document + using the element map and then serializes this DOM document to + STDOUT using the above-mentioned serialize() function. + +To run the example on the sample XML request documents simply +execute: + +$ ./driver balance.xml +$ ./driver withdraw.xml +$ ./driver deposit.xml diff --git a/examples/cxx/tree/messaging/balance.xml b/examples/cxx/tree/messaging/balance.xml new file mode 100644 index 0000000..57eeaed --- /dev/null +++ b/examples/cxx/tree/messaging/balance.xml @@ -0,0 +1,17 @@ + + + + + + + 123456789 + + diff --git a/examples/cxx/tree/messaging/deposit.xml b/examples/cxx/tree/messaging/deposit.xml new file mode 100644 index 0000000..9da3c59 --- /dev/null +++ b/examples/cxx/tree/messaging/deposit.xml @@ -0,0 +1,18 @@ + + + + + + + 123456789 + 1000000 + + diff --git a/examples/cxx/tree/messaging/dom-parse.cxx b/examples/cxx/tree/messaging/dom-parse.cxx new file mode 100644 index 0000000..d6ce204 --- /dev/null +++ b/examples/cxx/tree/messaging/dom-parse.cxx @@ -0,0 +1,118 @@ +// file : examples/cxx/tree/messaging/dom-parse.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include "dom-parse.hxx" + +#include + +#include +#include // chLatin_* +#include + +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +xml::dom::auto_ptr +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)); + +#if _XERCES_VERSION >= 30000 + + // Xerces-C++ 3.0.0 and later. + // + xml::dom::auto_ptr 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); + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + +#else // _XERCES_VERSION >= 30000 + + // Same as above but for Xerces-C++ 2 series. + // + xml::dom::auto_ptr parser ( + impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + parser->setFeature (XMLUni::fgDOMComments, false); + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + parser->setFeature (XMLUni::fgDOMEntities, false); + parser->setFeature (XMLUni::fgDOMNamespaces, true); + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + parser->setFeature (XMLUni::fgDOMValidation, validate); + parser->setFeature (XMLUni::fgXercesSchema, validate); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + parser->setErrorHandler (&ehp); + +#endif // _XERCES_VERSION >= 30000 + + // Prepare input stream. + // + xml::sax::std_input_source isrc (is, id); + Wrapper4InputSource wrap (&isrc, false); + +#if _XERCES_VERSION >= 30000 + xml::dom::auto_ptr doc (parser->parse (&wrap)); +#else + xml::dom::auto_ptr doc (parser->parse (wrap)); +#endif + + eh.throw_if_failed > (); + + return doc; +} diff --git a/examples/cxx/tree/messaging/dom-parse.hxx b/examples/cxx/tree/messaging/dom-parse.hxx new file mode 100644 index 0000000..640b28a --- /dev/null +++ b/examples/cxx/tree/messaging/dom-parse.hxx @@ -0,0 +1,23 @@ +// file : examples/cxx/tree/messaging/dom-parse.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include +#include + +#include +#include + +// 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::cxx::xml::dom::auto_ptr +parse (std::istream& is, + const std::string& id, + bool validate); + +#endif // DOM_PARSE diff --git a/examples/cxx/tree/messaging/dom-serialize.cxx b/examples/cxx/tree/messaging/dom-serialize.cxx new file mode 100644 index 0000000..c0f4311 --- /dev/null +++ b/examples/cxx/tree/messaging/dom-serialize.cxx @@ -0,0 +1,89 @@ +// file : examples/cxx/tree/messaging/dom-serialize.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include "dom-serialize.hxx" + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +void +serialize (std::ostream& os, + const xercesc::DOMDocument& doc, + const std::string& encoding) +{ + const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull}; + + // Get an implementation of the Load-Store (LS) interface. + // + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + + xml::dom::ostream_format_target oft (os); + +#if _XERCES_VERSION >= 30000 + + // Create a DOMSerializer. + // + xml::dom::auto_ptr writer ( + impl->createLSSerializer ()); + + DOMConfiguration* conf (writer->getDomConfig ()); + + // Set error handler. + // + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + + // Set some generally nice features. + // + conf->setParameter (XMLUni::fgDOMWRTDiscardDefaultContent, true); + conf->setParameter (XMLUni::fgDOMWRTFormatPrettyPrint, true); + + xml::dom::auto_ptr out (impl->createLSOutput ()); + out->setEncoding (xml::string (encoding).c_str ()); + out->setByteStream (&oft); + + writer->write (&doc, out.get ()); + +#else + + // Create a DOMWriter. + // + xml::dom::auto_ptr writer (impl->createDOMWriter ()); + + // Set error handler. + // + writer->setErrorHandler (&ehp); + + // Set encoding. + // + writer->setEncoding(xml::string (encoding).c_str ()); + + // Set some generally nice features. + // + writer->setFeature (XMLUni::fgDOMWRTDiscardDefaultContent, true); + writer->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true); + + writer->writeNode (&oft, doc); + +#endif + + eh.throw_if_failed > (); +} diff --git a/examples/cxx/tree/messaging/dom-serialize.hxx b/examples/cxx/tree/messaging/dom-serialize.hxx new file mode 100644 index 0000000..1a7e855 --- /dev/null +++ b/examples/cxx/tree/messaging/dom-serialize.hxx @@ -0,0 +1,21 @@ +// file : examples/cxx/tree/messaging/dom-serialize.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef DOM_SERIALIZE +#define DOM_SERIALIZE + +#include +#include + +#include + +// Serialize a DOM document to XML which is written to the standard +// output stream. +// +void +serialize (std::ostream& os, + const xercesc::DOMDocument& doc, + const std::string& encoding = "UTF-8"); + +#endif // DOM_SERIALIZE diff --git a/examples/cxx/tree/messaging/driver.cxx b/examples/cxx/tree/messaging/driver.cxx new file mode 100644 index 0000000..4c36aa4 --- /dev/null +++ b/examples/cxx/tree/messaging/driver.cxx @@ -0,0 +1,145 @@ +// file : examples/cxx/tree/messaging/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include +#include +#include + +#include +#include + +#include + +#include "dom-parse.hxx" +#include "dom-serialize.hxx" + +#include "protocol.hxx" + +using namespace std; +using namespace protocol; +using namespace xercesc; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " request.xml" << endl; + return 1; + } + + int r (0); + + // We need to initialize the Xerces-C++ runtime because we + // are doing the XML-to-DOM parsing ourselves. + // + XMLPlatformUtils::Initialize (); + + try + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + auto_ptr req, res; + + // Parse the XML request to a DOM document using the parse() + // function from dom-parse.hxx. + // + { + xml_schema::dom::auto_ptr doc (parse (ifs, argv[1], true)); + DOMElement& root (*doc->getDocumentElement ()); + + req = xml_schema::element_map::parse (root); + } + + // We can test which request we've got either using RTTI or by + // comparing the element names, as shown below. + // + if (balance* b = dynamic_cast (req.get ())) + { + account_t& a (b->value ()); + + cerr << "balance request for acc# " << a.account () << endl; + + res.reset (new success (balance_t (a.account (), 1000))); + } + else if (req->_name () == withdraw::name ()) + { + withdraw& w (static_cast (*req)); + change_t& c (w.value ()); + + wcerr << "withdrawal request for acc# " << c.account () << ", " + << "amount: " << c.amount () << endl; + + if (c.amount () > 1000) + res.reset (new insufficient_funds (balance_t (c.account (), 1000))); + else + res.reset (new success (balance_t (c.account (), 1000 - c.amount ()))); + + } + else if (req->_name () == deposit::name ()) + { + deposit& d (static_cast (*req)); + change_t& c (d.value ()); + + wcerr << "deposit request for acc# " << c.account () << ", " + << "amount: " << c.amount () << endl; + + res.reset (new success (balance_t (c.account (), 1000 + c.amount ()))); + } + + // Serialize the response to a DOM document. + // + namespace xml = xsd::cxx::xml; + + const XMLCh ls_id [] = {chLatin_L, chLatin_S, chNull}; + + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + + const string& name (res->_name ()); + const string& ns (res->_namespace ()); + + xml_schema::dom::auto_ptr doc ( + impl->createDocument ( + xml::string (ns).c_str (), + xml::string ("p:" + name).c_str (), + 0)); + + xml_schema::element_map::serialize (*doc->getDocumentElement (), *res); + + // Serialize the DOM document to XML using the serialize() function + // from dom-serialize.hxx. + // + cout << "response:" << endl + << endl; + + serialize (cout, *doc); + } + catch (const xml_schema::no_element_info& e) + { + // This exception indicates that we tried to parse or serialize + // an unknown element. + // + cerr << "unknown request: " << e.element_namespace () << "#" << + e.element_name () << endl; + r = 1; + } + catch (const xml_schema::exception& 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/examples/cxx/tree/messaging/makefile b/examples/cxx/tree/messaging/makefile new file mode 100644 index 0000000..2f4c7fe --- /dev/null +++ b/examples/cxx/tree/messaging/makefile @@ -0,0 +1,72 @@ +# file : examples/cxx/tree/messaging/makefile +# author : Boris Kolpackov +# 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 := protocol.xsd +cxx := driver.cxx dom-parse.cxx dom-serialize.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --root-element-all \ +--generate-element-type --generate-element-map --generate-serialization + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/messaging/protocol.xsd b/examples/cxx/tree/messaging/protocol.xsd new file mode 100644 index 0000000..3461133 --- /dev/null +++ b/examples/cxx/tree/messaging/protocol.xsd @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/messaging/withdraw.xml b/examples/cxx/tree/messaging/withdraw.xml new file mode 100644 index 0000000..16a7440 --- /dev/null +++ b/examples/cxx/tree/messaging/withdraw.xml @@ -0,0 +1,18 @@ + + + + + + + 123456789 + 1000000 + + diff --git a/examples/cxx/tree/mixed/README b/examples/cxx/tree/mixed/README new file mode 100644 index 0000000..c6f8be7 --- /dev/null +++ b/examples/cxx/tree/mixed/README @@ -0,0 +1,38 @@ +This example shows how to access the underlying DOM nodes in the +C++/Tree mapping in order to handle raw, "type-less content" such +as mixed content models, anyType/anySimpleType, and any/anyAttribute. + +In this example we use mixed content model to describe text with +embedded links, e.g., + + This paragraph talks about time. + +The example transforms such text into plain text with references, e.g., + + This paragraph talks about time[0]. + + [0] uri + +The example consists of the following files: + +text.xsd + XML Schema which describes "text with links" instance documents. + +text.xml + Sample XML instance document. + +text.hxx +text.cxx + C++ types that represent the given vocabulary and a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model. These are generated by XSD from text.xsd. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then uses + both the underlying DOM and statically-typed mapping to perform the + transformation. + +To run the example on the sample XML instance document simply execute: + +$ ./driver text.xml diff --git a/examples/cxx/tree/mixed/driver.cxx b/examples/cxx/tree/mixed/driver.cxx new file mode 100644 index 0000000..d905421 --- /dev/null +++ b/examples/cxx/tree/mixed/driver.cxx @@ -0,0 +1,121 @@ +// file : examples/cxx/tree/mixed/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include + +#include "text.hxx" + +// The following transcode() utility function is handy when working with +// Xerces. Include it after the generated header in order to get only char +// or wchar_t version depending on how you compiled your schemas. +// +#include + +using std::cout; +using std::cerr; +using std::endl; +using std::auto_ptr; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " text.xml" << endl; + return 1; + } + + using namespace xercesc; + + int r (0); + + // The Xerces-C++ DOM objects that will be associated with the + // document tree "out-live" the call to the parsing function. + // Therefore we need to initialize the Xerces-C++ runtime + // ourselves. + // + XMLPlatformUtils::Initialize (); + + try + { + auto_ptr t ( + text_ (argv[1], + xml_schema::flags::keep_dom | + xml_schema::flags::dont_initialize)); + + // Note that DOM association is preserved in copies but only if they + // are "complete", i.e., made from the root of the tree. + // + text copy (*t); + + // Print text. + // + { + namespace xml = xsd::cxx::xml; + + unsigned long ref (0); + DOMNode* root (copy._node ()); + + for (DOMNode* n (root->getFirstChild ()); + n != 0; + n = n->getNextSibling ()) + { + switch (n->getNodeType ()) + { + case DOMNode::TEXT_NODE: + { + cout << xml::transcode (n->getTextContent ()); + break; + } + case DOMNode::ELEMENT_NODE: + { + // Let's get back to a tree node from this DOM node. + // + xml_schema::type& t ( + *reinterpret_cast ( + n->getUserData (xml_schema::dom::tree_node_key))); + + anchor& a (dynamic_cast (t)); + + cout << a << "[" << ref << "]"; + + // Or we could continue using DOM interface: + // + //cout << xml::transcode (n->getTextContent ()) + // << "[" << ref << "]"; + + ++ref; + break; + } + default: + break; // Ignore all other nodes (e.g., comments, etc). + } + } + } + + // Print references. + // + { + unsigned long r (0); + + for (text::a_const_iterator i (copy.a ().begin ()); + i != copy.a ().end (); + ++i, ++r) + { + cout << "[" << r << "] " << i->href () << endl; + } + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + + XMLPlatformUtils::Terminate (); + return r; +} diff --git a/examples/cxx/tree/mixed/makefile b/examples/cxx/tree/mixed/makefile new file mode 100644 index 0000000..cc81bca --- /dev/null +++ b/examples/cxx/tree/mixed/makefile @@ -0,0 +1,73 @@ +# file : examples/cxx/tree/mixed/makefile +# author : Boris Kolpackov +# 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 := text.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/mixed/text.xml b/examples/cxx/tree/mixed/text.xml new file mode 100644 index 0000000..69abe8f --- /dev/null +++ b/examples/cxx/tree/mixed/text.xml @@ -0,0 +1,18 @@ + + + + + + +The first paragraph of this text talks about time. + +And this paragraph talks about space. + + diff --git a/examples/cxx/tree/mixed/text.xsd b/examples/cxx/tree/mixed/text.xsd new file mode 100644 index 0000000..8aa8280 --- /dev/null +++ b/examples/cxx/tree/mixed/text.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/multiroot/README b/examples/cxx/tree/multiroot/README new file mode 100644 index 0000000..b742422 --- /dev/null +++ b/examples/cxx/tree/multiroot/README @@ -0,0 +1,45 @@ +This example shows how to handle XML vocabularies with multiple +root elements using the C++/Tree mapping. + +See also the messaging example for an alternative approach that +uses the element type and element map features of the C++/Tree +mapping. + +The example consists of the following files: + +protocol.xsd + XML Schema which defines a simple bank account protocol with + requests such as withdraw and deposit. + +balance.xml +withdraw.xml +deposit.xml + Sample XML instances for the protocol requests. + +protocol.hxx +protocol.cxx + C++ types that represent the given vocabulary and a set of + parsing functions that convert XML documents to a tree-like + in-memory object model. These are generated by XSD from + protocol.xsd. + +dom-parse.hxx +dom-parse.cxx + Definition and implementation of the parse() function that + parses an XML document to a DOM document. + +driver.cxx + Driver for the example. It first calls the above parse() function + to parse the input file to a DOM document. It then determines the + type of request being handled and calls the corresponding parsing + function that constructs the object model from this DOM document. + Finally, it prints the content of this object model to STDERR. + This example intentionally does not support the deposit request + to show how to handle unknown documents. + +To run the example on the sample XML request documents simply +execute: + +$ ./driver balance.xml +$ ./driver withdraw.xml +$ ./driver deposit.xml diff --git a/examples/cxx/tree/multiroot/balance.xml b/examples/cxx/tree/multiroot/balance.xml new file mode 100644 index 0000000..055546a --- /dev/null +++ b/examples/cxx/tree/multiroot/balance.xml @@ -0,0 +1,17 @@ + + + + + + + 123456789 + + diff --git a/examples/cxx/tree/multiroot/deposit.xml b/examples/cxx/tree/multiroot/deposit.xml new file mode 100644 index 0000000..3207eee --- /dev/null +++ b/examples/cxx/tree/multiroot/deposit.xml @@ -0,0 +1,18 @@ + + + + + + + 123456789 + 1000000 + + diff --git a/examples/cxx/tree/multiroot/dom-parse.cxx b/examples/cxx/tree/multiroot/dom-parse.cxx new file mode 100644 index 0000000..3a67626 --- /dev/null +++ b/examples/cxx/tree/multiroot/dom-parse.cxx @@ -0,0 +1,118 @@ +// file : examples/cxx/tree/multiroot/dom-parse.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include "dom-parse.hxx" + +#include + +#include +#include // chLatin_* +#include + +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +xml::dom::auto_ptr +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)); + +#if _XERCES_VERSION >= 30000 + + // Xerces-C++ 3.0.0 and later. + // + xml::dom::auto_ptr 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); + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + +#else // _XERCES_VERSION >= 30000 + + // Same as above but for Xerces-C++ 2 series. + // + xml::dom::auto_ptr parser ( + impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + parser->setFeature (XMLUni::fgDOMComments, false); + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + parser->setFeature (XMLUni::fgDOMEntities, false); + parser->setFeature (XMLUni::fgDOMNamespaces, true); + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + parser->setFeature (XMLUni::fgDOMValidation, validate); + parser->setFeature (XMLUni::fgXercesSchema, validate); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + parser->setErrorHandler (&ehp); + +#endif // _XERCES_VERSION >= 30000 + + // Prepare input stream. + // + xml::sax::std_input_source isrc (is, id); + Wrapper4InputSource wrap (&isrc, false); + +#if _XERCES_VERSION >= 30000 + xml::dom::auto_ptr doc (parser->parse (&wrap)); +#else + xml::dom::auto_ptr doc (parser->parse (wrap)); +#endif + + eh.throw_if_failed > (); + + return doc; +} diff --git a/examples/cxx/tree/multiroot/dom-parse.hxx b/examples/cxx/tree/multiroot/dom-parse.hxx new file mode 100644 index 0000000..c3bbf71 --- /dev/null +++ b/examples/cxx/tree/multiroot/dom-parse.hxx @@ -0,0 +1,23 @@ +// file : examples/cxx/tree/multiroot/dom-parse.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include +#include + +#include +#include + +// 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::cxx::xml::dom::auto_ptr +parse (std::istream& is, + const std::string& id, + bool validate); + +#endif // DOM_PARSE diff --git a/examples/cxx/tree/multiroot/driver.cxx b/examples/cxx/tree/multiroot/driver.cxx new file mode 100644 index 0000000..cd5be34 --- /dev/null +++ b/examples/cxx/tree/multiroot/driver.cxx @@ -0,0 +1,125 @@ +// file : examples/cxx/tree/multiroot/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include +#include + +#include +#include + +#include // xml::transcode + +#include "dom-parse.hxx" + +#include "protocol.hxx" + +using namespace std; +using namespace protocol; + +// Parse an XML document and return a pointer to request_t which can +// then be tested with dynamic_cast. If your vocabulary does not have +// a common base type for all root element types then you can use +// xml_schema::type which is a base for all generated types. +// +auto_ptr +parse (istream& is, const string& id) +{ + using namespace xercesc; + namespace xml = xsd::cxx::xml; + + // Parse an XML instance to a DOM document using the parse() + // function from dom-parse.hxx. + // + xml_schema::dom::auto_ptr doc (parse (is, id, true)); + + DOMElement* root (doc->getDocumentElement ()); + + string ns (xml::transcode (root->getNamespaceURI ())); + string name (xml::transcode (root->getLocalName ())); + + auto_ptr r; + + // We could have handled the result directly in this function + // instead of returning it as an opaque pointer and using + // dynamic_cast later to figure out which request we are dealing + // with. + // + if (ns == "http://www.codesynthesis.com/protocol") + { + if (name == "balance") + { + // Use the balance parsing function. + // + r.reset (balance (*doc).release ()); + } + else if (name == "withdraw") + { + // Use the withdraw parsing function. + // + r.reset (withdraw (*doc).release ()); + } + } + + if (r.get () == 0) + cerr << "ignoring unknown request: " << ns << "#" << name << endl; + + return r; +} + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " request.xml" << endl; + return 1; + } + + int r (0); + + // We need to initialize the Xerces-C++ runtime because we + // are doing the XML-to-DOM parsing ourselves. + // + xercesc::XMLPlatformUtils::Initialize (); + + try + { + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + auto_ptr r (parse (ifs, argv[1])); + + // Let's print what we've got. + // + if (balance_t* b = dynamic_cast (r.get ())) + { + cerr << "balance request for acc# " << b->account () << endl; + } + else if (withdraw_t* w = dynamic_cast (r.get ())) + { + cerr << "withdrawal request for acc# " << w->account () << ", " + << "amount: " << w->amount () << endl; + } + else + { + cerr << "unknown request" << endl; + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + xercesc::XMLPlatformUtils::Terminate (); + return r; +} diff --git a/examples/cxx/tree/multiroot/makefile b/examples/cxx/tree/multiroot/makefile new file mode 100644 index 0000000..37e2722 --- /dev/null +++ b/examples/cxx/tree/multiroot/makefile @@ -0,0 +1,71 @@ +# file : examples/cxx/tree/multiroot/makefile +# author : Boris Kolpackov +# 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 := protocol.xsd +cxx := driver.cxx dom-parse.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --root-element-all + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/multiroot/protocol.xsd b/examples/cxx/tree/multiroot/protocol.xsd new file mode 100644 index 0000000..28e8478 --- /dev/null +++ b/examples/cxx/tree/multiroot/protocol.xsd @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/multiroot/withdraw.xml b/examples/cxx/tree/multiroot/withdraw.xml new file mode 100644 index 0000000..4df736f --- /dev/null +++ b/examples/cxx/tree/multiroot/withdraw.xml @@ -0,0 +1,18 @@ + + + + + + + 123456789 + 1000000 + + diff --git a/examples/cxx/tree/performance/README b/examples/cxx/tree/performance/README new file mode 100644 index 0000000..440ee62 --- /dev/null +++ b/examples/cxx/tree/performance/README @@ -0,0 +1,60 @@ +This example measures the performance of parsing and serialization in +the C++/Tree mapping. It also shows how to structure your code to +achieve the maximum performance for these two operations. + +The example consists of the following files: + +test.xsd + XML Schema which describes the test vocabulary. + +test-5k.xml +test-50k.xml +test-500k.xml + Test XML documents of various sizes. + +gen.cxx + Program to generate a test document of desired size. + +time.hxx +time.cxx + Class definition that represents time. + +test.hxx +test.ixx +test.cxx + C++ types that represent the given vocabulary, a set of parsing + functions that convert XML documents to a tree-like in-memory object + model, and a set of serialization functions that convert the object + model back to XML. These are generated by the XSD compiler from + test.xsd. + +parsing.cxx + Parsing performance test. It first reads the entire document into + a memory buffer. It then creates a DOM parser and pre-parses and + caches the schema if validation is enabled. Finally, it runs the + performance measurement loop which on each iteration parses the + XML document from the in-memory buffer into DOM and then DOM to + the object model. + +serialization.cxx + Serialization performance test. It first parses the XML document + into the object model. It then creates a memory buffer into which + the document is serialized and a DOM serializer. Finally, it runs + the performance measurement loop which on each iteration serializes + the object model to DOM and DOM to XML. + +driver.cxx + Driver for the example. It first parses the command line arguments. + It then initializes the Xerces-C++ runtime and calls the parsing + and serialization tests described above. + +To run the example on a test XML document simply execute: + +$ ./driver test-50k.xml + +The -v option can be used to turn on validation in the underlying XML +parser (off by default). The -i option can be used to specify the +number of parsing and serialization iterations (1000 by default). For +example: + +$ ./driver -v -i 100 test-500k.xml diff --git a/examples/cxx/tree/performance/driver.cxx b/examples/cxx/tree/performance/driver.cxx new file mode 100644 index 0000000..f3e388b --- /dev/null +++ b/examples/cxx/tree/performance/driver.cxx @@ -0,0 +1,91 @@ +// file : examples/cxx/tree/performance/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include +#include +#include + +#include + +using namespace std; + +// See parsing.cxx +// +bool +parsing (const char* file, unsigned long iter, bool validate); + +// See serialization.cxx +// +bool +serialization (const char* file, unsigned long iter); + +int +main (int argc, char* argv[]) +{ + if (argc < 2) + { + cerr << "usage: " << argv[0] << " [-v] [-i ] test.xml" << endl + << "\t -v turn on validation (default is off)" << endl + << "\t -i number of iterations to perform (default is 1000)" << endl; + return 1; + } + + bool validate (false); + unsigned long iter (1000); + const char* file (0); + + // Parse command line arguments. + // + for (int i (1); i < argc; ++i) + { + std::string arg (argv[i]); + + if (arg == "-v") + { + validate = true; + } + else if (arg == "-i") + { + if (++i == argc) + { + cerr << "argument expected for the -i option" << endl; + return 1; + } + + iter = 0; + istringstream is (argv[i]); + is >> iter; + + if (iter == 0) + { + cerr << "invalid argument for the -i option" << endl; + return 1; + } + } + else + { + file = argv[i]; + break; + } + } + + if (file == 0) + { + cerr << "no input file specified" << endl; + return 1; + } + + int r (0); + + xercesc::XMLPlatformUtils::Initialize (); + + // Call parsing and serialization tests. + // + if (!parsing (file, iter, validate) || !serialization (file, iter)) + r = 1; + + xercesc::XMLPlatformUtils::Terminate (); + + return r; +} diff --git a/examples/cxx/tree/performance/gen.cxx b/examples/cxx/tree/performance/gen.cxx new file mode 100644 index 0000000..b6392c0 --- /dev/null +++ b/examples/cxx/tree/performance/gen.cxx @@ -0,0 +1,76 @@ +#include +#include +#include + +using namespace std; + +static const char* enums[] = +{ + "romance", + "fiction", + "horror", + "history", + "philosophy" +}; + +int +main (int argc, char* argv[]) +{ + if (argc != 3) + { + cerr << "usage: " << argv[0] << " " << endl; + return 1; + } + + unsigned long n (0); + istringstream is (argv[1]); + is >> n; + + if (n == 0) + { + cerr << "record count argument should be a positive number" << endl; + return 1; + } + + ofstream ofs (argv[2]); + + if (!ofs.is_open ()) + { + cerr << "unable to open '" << argv[2] << "' in write mode" << endl; + return 1; + } + + ofs << ""; + + unsigned short ch (1), en (0); + + for (unsigned long i (0); i < n; ++i) + { + ofs << "" + << "42" + << "42345.4232" + << "name123_45"; + + if (i % 2 == 1) + ofs << "one two three"; + + ofs << "" << ch << " choice" + << "" << enums[en] << "" + << ""; + + if (++ch > 4) + ch = 1; + + if (++en > 4) + en = 0; + } + + ofs << ""; +} diff --git a/examples/cxx/tree/performance/makefile b/examples/cxx/tree/performance/makefile new file mode 100644 index 0000000..f60e281 --- /dev/null +++ b/examples/cxx/tree/performance/makefile @@ -0,0 +1,72 @@ +# file : examples/cxx/tree/performance/makefile +# author : Boris Kolpackov +# 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 parsing.cxx serialization.cxx time.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := \ +--generate-inline --generate-serialization + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/performance/parsing.cxx b/examples/cxx/tree/performance/parsing.cxx new file mode 100644 index 0000000..fd27fb2 --- /dev/null +++ b/examples/cxx/tree/performance/parsing.cxx @@ -0,0 +1,200 @@ +// file : examples/cxx/tree/performance/parsing.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include // std::size_t +#include +#include + +#include +#if _XERCES_VERSION >= 30000 +# include +#else +# include +#endif +#include +#include + +#include + +#include +#include + +#include + +#include +#include + +#include "time.hxx" +#include "test.hxx" + +using namespace std; + +bool +parsing (const char* file, unsigned long iter, bool validate) +{ + try + { + cerr << "parsing:" << endl; + + ifstream ifs; + ifs.exceptions (ios_base::failbit); + ifs.open (file, ios::in | ios::ate); + + std::size_t size (ifs.tellg ()); + ifs.seekg (0, ios::beg); + + char* buf = new char[size]; + ifs.read (buf, size); + ifs.close (); + + cerr << " document size: " << size << " bytes" << endl + << " iterations: " << iter << endl; + + // Create XML parser that we are going to use in all iterations. + // + using namespace xercesc; + + const XMLCh ls_id[] = + {xercesc::chLatin_L, xercesc::chLatin_S, xercesc::chNull}; + + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + + // Use the error handler implementation provided by the XSD runtime. + // + xsd::cxx::tree::error_handler eh; + xsd::cxx::xml::dom::bits::error_handler_proxy ehp (eh); + +#if _XERCES_VERSION >= 30000 + + xml_schema::dom::auto_ptr parser ( + impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + DOMConfiguration* conf (parser->getDomConfig ()); + + conf->setParameter (XMLUni::fgDOMComments, false); + conf->setParameter (XMLUni::fgDOMDatatypeNormalization, true); + conf->setParameter (XMLUni::fgDOMEntities, false); + conf->setParameter (XMLUni::fgDOMNamespaces, true); + conf->setParameter (XMLUni::fgDOMElementContentWhitespace, false); + + // Set error handler. + // + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + + if (validate) + { + conf->setParameter (XMLUni::fgDOMValidate, true); + conf->setParameter (XMLUni::fgXercesSchema, true); + conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false); + + // If we are validating, pre-load and cache the schema. + // + parser->loadGrammar ("test.xsd", Grammar::SchemaGrammarType, true); + conf->setParameter (XMLUni::fgXercesUseCachedGrammarInParse, true); + } + else + { + conf->setParameter (XMLUni::fgDOMValidate, false); + conf->setParameter (XMLUni::fgXercesSchema, false); + conf->setParameter (XMLUni::fgXercesSchemaFullChecking, false); + } + + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + +#else // _XERCES_VERSION >= 30000 + + // Same as above but for Xerces-C++ 2 series. + // + xml_schema::dom::auto_ptr parser ( + impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + parser->setFeature (XMLUni::fgDOMComments, false); + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + parser->setFeature (XMLUni::fgDOMEntities, false); + parser->setFeature (XMLUni::fgDOMNamespaces, true); + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + + parser->setErrorHandler (&ehp); + + if (validate) + { + parser->setFeature (XMLUni::fgDOMValidation, true); + parser->setFeature (XMLUni::fgXercesSchema, true); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + + parser->loadGrammar ("test.xsd", Grammar::SchemaGrammarType, true); + parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true); + } + else + { + parser->setFeature (XMLUni::fgDOMValidation, false); + parser->setFeature (XMLUni::fgXercesSchema, false); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + } + + parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); + +#endif + + // Create memory buffer input source. + // + MemBufInputSource is ( + reinterpret_cast (buf), size, file, false); + is.setCopyBufToStream (false); + Wrapper4InputSource wis (&is, false); + + // Parsing loop. + // + os::time start; + + for (unsigned long i (0); i < iter; ++i) + { + // First parse XML to DOM reusing the parser we created above. + // +#if _XERCES_VERSION >= 30000 + xml_schema::dom::auto_ptr doc (parser->parse (&wis)); +#else + xml_schema::dom::auto_ptr doc (parser->parse (wis)); +#endif + eh.throw_if_failed (); + + // Then parse DOM to the object model. + // + auto_ptr r (test::root_ (*doc)); + } + + os::time end; + os::time time (end - start); + + delete[] buf; + + cerr << " time: " << time << " sec" << endl; + + double ms (time.sec () * 1000000ULL + time.nsec () / 1000ULL); + + // Calculate throughput in documents/sec. + // + double tpd ((iter / ms) * 1000000); + cerr << " throughput: " << tpd << " documents/sec" << endl; + + // Calculate throughput in MBytes/sec. + // + double tpb (((size * iter) / ms) * 1000000/(1024*1024)); + cerr << " throughput: " << tpb << " MBytes/sec" << endl; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return false; + } + catch (std::ios_base::failure const&) + { + cerr << "io failure" << endl; + return false; + } + + return true; +} diff --git a/examples/cxx/tree/performance/serialization.cxx b/examples/cxx/tree/performance/serialization.cxx new file mode 100644 index 0000000..5ad6654 --- /dev/null +++ b/examples/cxx/tree/performance/serialization.cxx @@ -0,0 +1,151 @@ +// file : examples/cxx/tree/performance/serialization.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include // std::size_t +#include +#include + +#include +#if _XERCES_VERSION >= 30000 +# include +# include +#else +# include +#endif +#include +#include + +#include + +#include + +#include +#include + +#include "time.hxx" +#include "test.hxx" + +using namespace std; + +bool +serialization (const char* file, unsigned long iter) +{ + try + { + using namespace xercesc; + + cerr << "serialization:" << endl; + + // Get the object model using the standard parsing function. + // + auto_ptr r ( + test::root_ (file, + xml_schema::flags::dont_initialize | + xml_schema::flags::dont_validate)); + + // Serialize it to the in-memory buffer. This makes sure the buffer + // pre-allocates enough memory. + // + xml_schema::namespace_infomap map; + map["t"].name = "test"; + map["t"].schema = "test.xsd"; + + MemBufFormatTarget ft (10240); + test::root_ (ft, *r, map, "UTF-8", + xml_schema::flags::dont_initialize | + xml_schema::flags::dont_pretty_print | + xml_schema::flags::no_xml_declaration); + + std::size_t size (ft.getLen ()); + cerr << " document size: " << size << " bytes" << endl + << " iterations: " << iter << endl; + + // Create XML serializer that we are going to use in all iterations. + // + const XMLCh ls_id[] = + {xercesc::chLatin_L, xercesc::chLatin_S, xercesc::chNull}; + + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation (ls_id)); + + // Use the error handler implementation provided by the XSD runtime. + // + xsd::cxx::tree::error_handler eh; + xsd::cxx::xml::dom::bits::error_handler_proxy ehp (eh); + +#if _XERCES_VERSION >= 30000 + xml_schema::dom::auto_ptr writer ( + impl->createLSSerializer ()); + + DOMConfiguration* conf (writer->getDomConfig ()); + + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + conf->setParameter (XMLUni::fgDOMXMLDeclaration, false); + + xml_schema::dom::auto_ptr out (impl->createLSOutput ()); + + out->setByteStream (&ft); +#else + // Same as above but for Xerces-C++ 2 series. + // + xml_schema::dom::auto_ptr writer (impl->createDOMWriter ()); + + writer->setErrorHandler (&ehp); + writer->setFeature (XMLUni::fgDOMXMLDeclaration, false); +#endif + + // Serialization loop. + // + os::time start; + + for (unsigned long i (0); i < iter; ++i) + { + // First serialize the object model to DOM. + // + xml_schema::dom::auto_ptr doc (test::root_ (*r, map)); + + ft.reset (); + + // Then serialize DOM to XML reusing the serializer we created above. + // +#if _XERCES_VERSION >= 30000 + writer->write (doc.get (), out.get ()); +#else + writer->writeNode (&ft, *doc); +#endif + + eh.throw_if_failed (); + } + + os::time end; + os::time time (end - start); + + cerr << " time: " << time << " sec" << endl; + + double ms (time.sec () * 1000000ULL + time.nsec () / 1000ULL); + + // Calculate throughput in documents/sec. + // + double tpd ((iter / ms) * 1000000); + cerr << " throughput: " << tpd << " documents/sec" << endl; + + // Calculate throughput in MBytes/sec. + // + double tpb (((size * iter) / ms) * 1000000/(1024*1024)); + cerr << " throughput: " << tpb << " MBytes/sec" << endl; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return false; + } + catch (std::ios_base::failure const&) + { + cerr << "io failure" << endl; + return false; + } + + return true; +} diff --git a/examples/cxx/tree/performance/test-500k.xml b/examples/cxx/tree/performance/test-500k.xml new file mode 100644 index 0000000..e895584 --- /dev/null +++ b/examples/cxx/tree/performance/test-500k.xml @@ -0,0 +1 @@ +4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy \ No newline at end of file diff --git a/examples/cxx/tree/performance/test-50k.xml b/examples/cxx/tree/performance/test-50k.xml new file mode 100644 index 0000000..42e22f3 --- /dev/null +++ b/examples/cxx/tree/performance/test-50k.xml @@ -0,0 +1 @@ +4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction \ No newline at end of file diff --git a/examples/cxx/tree/performance/test-5k.xml b/examples/cxx/tree/performance/test-5k.xml new file mode 100644 index 0000000..168cb09 --- /dev/null +++ b/examples/cxx/tree/performance/test-5k.xml @@ -0,0 +1 @@ +4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction4242345.4232name123_451 choicehorror4242345.4232name123_45one two three2 choicehistory4242345.4232name123_453 choicephilosophy4242345.4232name123_45one two three4 choiceromance4242345.4232name123_451 choicefiction4242345.4232name123_45one two three2 choicehorror4242345.4232name123_453 choicehistory4242345.4232name123_45one two three4 choicephilosophy4242345.4232name123_451 choiceromance4242345.4232name123_45one two three2 choicefiction4242345.4232name123_453 choicehorror4242345.4232name123_45one two three4 choicehistory4242345.4232name123_451 choicephilosophy4242345.4232name123_45one two three2 choiceromance4242345.4232name123_453 choicefiction4242345.4232name123_45one two three4 choicehorror4242345.4232name123_451 choicehistory4242345.4232name123_45one two three2 choicephilosophy4242345.4232name123_453 choiceromance4242345.4232name123_45one two three4 choicefiction \ No newline at end of file diff --git a/examples/cxx/tree/performance/test.xsd b/examples/cxx/tree/performance/test.xsd new file mode 100644 index 0000000..cf1f046 --- /dev/null +++ b/examples/cxx/tree/performance/test.xsd @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/performance/time.cxx b/examples/cxx/tree/performance/time.cxx new file mode 100644 index 0000000..c2de6dc --- /dev/null +++ b/examples/cxx/tree/performance/time.cxx @@ -0,0 +1,47 @@ +// file : examples/cxx/tree/performance/time.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include "time.hxx" + +#if defined (WIN32) || defined (__WIN32__) +# define WIN32_LEAN_AND_MEAN +# include // GetSystemTimeAsFileTime +#else +# include // gettimeofday +# include // timeval +#endif + +#include // std::ostream +#include // std::setfill, std::setw + +namespace os +{ + time:: + time () + { +#if defined (WIN32) || defined (__WIN32__) + FILETIME ft; + GetSystemTimeAsFileTime (&ft); + unsigned long long v ( + (unsigned long long (ft.dwHighDateTime) << 32) + ft.dwLowDateTime); + + sec_ = static_cast (v / 10000000ULL); + nsec_ = static_cast ((v % 10000000ULL) * 100); +#else + timeval tv; + if (gettimeofday(&tv, 0) != 0) + throw failed (); + + sec_ = static_cast (tv.tv_sec); + nsec_ = static_cast (tv.tv_usec * 1000); +#endif + } + + std::ostream& + operator<< (std::ostream& o, time const& t) + { + return o << t.sec () << '.' + << std::setfill ('0') << std::setw (9) << t.nsec (); + } +} diff --git a/examples/cxx/tree/performance/time.hxx b/examples/cxx/tree/performance/time.hxx new file mode 100644 index 0000000..f83e628 --- /dev/null +++ b/examples/cxx/tree/performance/time.hxx @@ -0,0 +1,111 @@ +// file : examples/cxx/tree/performance/time.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef TIME_HXX +#define TIME_HXX + +#include // std::ostream& + +namespace os +{ + class time + { + public: + class failed {}; + + // Create a time object representing the current time. + // + time (); + + time (unsigned long long nsec) + { + sec_ = static_cast (nsec / 1000000000ULL); + nsec_ = static_cast (nsec % 1000000000ULL); + } + + time (unsigned long sec, unsigned long nsec) + { + sec_ = sec; + nsec_ = nsec; + } + + public: + unsigned long + sec () const + { + return sec_; + } + + unsigned long + nsec () const + { + return nsec_; + } + + public: + class overflow {}; + class underflow {}; + + time + operator+= (time const& b) + { + unsigned long long tmp = 0ULL + nsec_ + b.nsec_; + + sec_ += static_cast (b.sec_ + tmp / 1000000000ULL); + nsec_ = static_cast (tmp % 1000000000ULL); + + return *this; + } + + time + operator-= (time const& b) + { + if (*this < b) + throw underflow (); + + sec_ -= b.sec_; + + if (nsec_ < b.nsec_) + { + --sec_; + nsec_ += 1000000000ULL - b.nsec_; + } + else + nsec_ -= b.nsec_; + + return *this; + } + + friend time + operator+ (time const& a, time const& b) + { + time r (a); + r += b; + return r; + } + + friend time + operator- (time const& a, time const& b) + { + time r (a); + r -= b; + return r; + } + + friend bool + operator < (time const& a, time const& b) + { + return (a.sec_ < b.sec_) || (a.sec_ == b.sec_ && a.nsec_ < b.nsec_); + } + + private: + unsigned long sec_; + unsigned long nsec_; + }; + + std::ostream& + operator<< (std::ostream&, time const&); +} + +#endif // TIME_HXX diff --git a/examples/cxx/tree/polymorphism/README b/examples/cxx/tree/polymorphism/README new file mode 100644 index 0000000..05d794f --- /dev/null +++ b/examples/cxx/tree/polymorphism/README @@ -0,0 +1,28 @@ +This example shows how to use XML Schema polymorphism features such as +xsi:type attributes and substitution groups in the C++/Tree mapping. + +The example consists of the following files: + +supermen.xsd + XML Schema which describes the "supermen" instance documents. + +supermen.xml + Sample XML instance document. + +supermen.hxx +supermen.cxx + C++ types that represent the given vocabulary, a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model, and a set of serialization functions that convert the + object model back to XML. These are generated by XSD from supermen.xsd. + Note the use of the --generate-polymorphic command line option. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the content of the object model to STDERR. Finally, the driver serializes + the object model back to XML. + +To run the example on the sample XML instance document simply execute: + +$ ./driver instance.xml diff --git a/examples/cxx/tree/polymorphism/driver.cxx b/examples/cxx/tree/polymorphism/driver.cxx new file mode 100644 index 0000000..582e2dd --- /dev/null +++ b/examples/cxx/tree/polymorphism/driver.cxx @@ -0,0 +1,60 @@ +// file : examples/cxx/tree/polymorphism/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "supermen.hxx" + +using std::cerr; +using std::endl; +using std::auto_ptr; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " supermen.xml" << endl; + return 1; + } + + try + { + auto_ptr sm (supermen_ (argv[1])); + + supermen copy (*sm); // Dynamic types are preserved in copies. + + // Print what we've got. + // + for (supermen::person_const_iterator i (copy.person ().begin ()); + i != copy.person ().end (); + ++i) + { + cerr << i->name (); + + if (const superman* s = dynamic_cast (&*i)) + { + if (s->can_fly ()) + cerr << ", flying superman"; + else + cerr << ", superman"; + } + + cerr << endl; + } + + // Serialize back to XML. + // + xml_schema::namespace_infomap map; + map[""].schema = "supermen.xsd"; + + supermen_ (std::cout, copy, map); + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/examples/cxx/tree/polymorphism/makefile b/examples/cxx/tree/polymorphism/makefile new file mode 100644 index 0000000..f4e0b16 --- /dev/null +++ b/examples/cxx/tree/polymorphism/makefile @@ -0,0 +1,72 @@ +# file : examples/cxx/tree/polymorphism/makefile +# author : Boris Kolpackov +# 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 := supermen.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --generate-polymorphic --generate-serialization --root-element-last + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/polymorphism/supermen.xml b/examples/cxx/tree/polymorphism/supermen.xml new file mode 100644 index 0000000..5053142 --- /dev/null +++ b/examples/cxx/tree/polymorphism/supermen.xml @@ -0,0 +1,26 @@ + + + + + + + + John Doe + + + + James "007" Bond + + + + Bruce Wayne + + + diff --git a/examples/cxx/tree/polymorphism/supermen.xsd b/examples/cxx/tree/polymorphism/supermen.xsd new file mode 100644 index 0000000..ffdd21c --- /dev/null +++ b/examples/cxx/tree/polymorphism/supermen.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/streaming/README b/examples/cxx/tree/streaming/README new file mode 100644 index 0000000..51e5c14 --- /dev/null +++ b/examples/cxx/tree/streaming/README @@ -0,0 +1,22 @@ +This example shows how to create an XML document by performing multiple +serializations of its smaller parts. This can be useful when the +document is too large to fit into memory or when the other end needs +to start processing without waiting for the whole document (streaming). + +The example consists of the following files: + +records.xsd + XML Schema which describes a collection of data records. + +records.hxx +records.cxx + C++ types that represent the given vocabulary as well as serialization + functions. These are generated by XSD from records.xsd. + +driver.cxx + Driver for the example. It progressively serializes one thousand data + record into a file (out.xml). + +To run the example simply execute: + +$ ./driver diff --git a/examples/cxx/tree/streaming/driver.cxx b/examples/cxx/tree/streaming/driver.cxx new file mode 100644 index 0000000..6afc1ce --- /dev/null +++ b/examples/cxx/tree/streaming/driver.cxx @@ -0,0 +1,65 @@ +// file : examples/cxx/tree/streaming/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include +#include + +#include "records.hxx" + +using std::cerr; +using std::endl; +using std::ios_base; + +int +main () +{ + try + { + std::ofstream ofs; + ofs.exceptions (ios_base::badbit | ios_base::failbit); + ofs.open ("out.xml"); + + // We will need to create XML declaration as well as open and close + // the root tag ourselves. + // + ofs << "" << endl + << "" << endl; + + // For performance reasons, we would like to initialize/terminate + // Xerces-C++ ourselves once instead of letting the serialization + // function do it for every record. + // + xercesc::XMLPlatformUtils::Initialize (); + + xml_schema::namespace_infomap map; + + for (unsigned long i (0); i < 1000; ++i) + { + // Create the next record. + // + record r ("data"); + + record_ (ofs, + r, + map, + "UTF-8", + xml_schema::flags::dont_initialize | + xml_schema::flags::no_xml_declaration); + } + + xercesc::XMLPlatformUtils::Terminate (); + + ofs << "" << endl; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } + catch (const std::ios_base::failure&) + { + cerr << "io failure" << endl; + return 1; + } +} diff --git a/examples/cxx/tree/streaming/makefile b/examples/cxx/tree/streaming/makefile new file mode 100644 index 0000000..0c478e0 --- /dev/null +++ b/examples/cxx/tree/streaming/makefile @@ -0,0 +1,74 @@ +# file : examples/cxx/tree/streaming/makefile +# author : Boris Kolpackov +# 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 := records.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --generate-serialization \ + --suppress-parsing \ + --root-element-all + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# 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)/out.xml) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/streaming/records.xsd b/examples/cxx/tree/streaming/records.xsd new file mode 100644 index 0000000..2b357e6 --- /dev/null +++ b/examples/cxx/tree/streaming/records.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/wildcard/README b/examples/cxx/tree/wildcard/README new file mode 100644 index 0000000..d451509 --- /dev/null +++ b/examples/cxx/tree/wildcard/README @@ -0,0 +1,34 @@ +This example shows how to use the optional wildcard mapping provided +by C++/Tree to parse, access, modify, and serialize the XML data +matched by XML Schema wildcards (any and anyAttribute). For an +alternative approach that employes type customization see the +custom/wildcard example. + +The example consists of the following files: + +email.xsd + XML Schema which describes a simple email format with the + extensible envelope type. + +email.xml + Sample email message. + +email.hxx +email.ixx +email.cxx + C++ types that represent the given vocabulary, a set of parsing + functions that convert XML instance documents to a tree-like in-memory + object model, and a set of serialization functions that convert the + object model back to XML. These are generated by XSD from email.xsd. + Note that the --generate-wildcard option is used to request the + wildcard mapping. + +driver.cxx + Driver for the example. It first calls one of the parsing functions + that constructs the object model from the input file. It then prints + the content of the object model to STDERR. Next the driver creates a + reply email which is then serialized to XML. + +To run the example on the sample XML instance document simply execute: + +$ ./driver email.xml diff --git a/examples/cxx/tree/wildcard/driver.cxx b/examples/cxx/tree/wildcard/driver.cxx new file mode 100644 index 0000000..5fc6abf --- /dev/null +++ b/examples/cxx/tree/wildcard/driver.cxx @@ -0,0 +1,160 @@ +// file : examples/cxx/tree/wildcard/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include +#include // std::auto_ptr +#include // std::memcpy +#include + +#include +#include + +#include "email.hxx" + +// The following string class keeps us sane when working with Xerces. +// Include it after the generated header in order to get only char or +// wchar_t version depending on how you compiled your schemas. +// +#include + +using std::cerr; +using std::endl; +using std::string; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " email.xml" << endl; + return 1; + } + + using namespace xercesc; + + int r (0); + + // The Xerces-C++ DOM objects that will be used to store the + // content matched by wildcards "out-live" the call to the + // parsing function. Therefore we need to initialize the + // Xerces-C++ runtime ourselves. + // + XMLPlatformUtils::Initialize (); + + try + { + using namespace email; + namespace xml = xsd::cxx::xml; + + // Read in the message. + // + std::auto_ptr msg ( + message (argv[1], xml_schema::flags::dont_initialize)); + + // Print what we've got. + // + cerr << "To: " << msg->to () << endl + << "From: " << msg->from () << endl + << "Subject: " << msg->subject () << endl; + + envelope::any_sequence& body (msg->any ()); + + for (envelope::any_iterator i (body.begin ()); i != body.end (); ++i) + { + DOMElement& e (*i); + string name (xml::transcode (e.getLocalName ())); + + if (name == "text") + { + // Create object representation for the text element. + // + xml_schema::string text (e); + + cerr << text << endl + << endl; + } + else if (name == "binary") + { + // Create object representation for the binary element. + // + binary bin (e); + + cerr << "binary: " << bin.name () << " type: " << bin.mime () << endl + << endl; + } + else + { + cerr << "unknown body type: " << name << endl; + } + } + + // Create a reply message. + // + envelope reply (msg->from (), msg->to (), "Re: " + msg->subject ()); + + // Copy the thread-id attribute from the original message if any. + // + envelope::any_attribute_set& as (msg->any_attribute ()); + envelope::any_attribute_iterator ti ( + as.find ("http://www.codesynthesis.com/email", "thread-id")); + + if (ti != as.end ()) + reply.any_attribute ().insert (*ti); + + // Add a text body. + // + DOMDocument& doc (reply.dom_document ()); + envelope::any_sequence& rbody (reply.any ()); + + xml_schema::string text ("Hi!\n\n" + "Indeed nice pictures. Check out mine.\n\n" + "Jane"); + + DOMElement* e ( + doc.createElementNS ( + xml::string ("http://www.codesynthesis.com/email").c_str (), + xml::string ("eml:text").c_str ())); + + *e << text; + rbody.push_back (e); + + // Add a (fake) image. + // + binary pic ("pic.jpg", "image/jpeg"); + pic.size (3); + std::memcpy (pic.data (), "123", 3); + + e = doc.createElementNS ( + xml::string ("http://www.codesynthesis.com/email").c_str (), + xml::string ("eml:binary").c_str ()); + + *e << pic; + rbody.push_back (e); + + + // Prepare namespace mapping and schema location information for + // serialization. + // + xml_schema::namespace_infomap map; + + map["eml"].name = "http://www.codesynthesis.com/email"; + map["eml"].schema = "email.xsd"; + + // Write it out. + // + message (std::cout, + reply, + map, + "UTF-8", + xml_schema::flags::dont_initialize); + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + + XMLPlatformUtils::Terminate (); + return r; +} diff --git a/examples/cxx/tree/wildcard/email.xml b/examples/cxx/tree/wildcard/email.xml new file mode 100644 index 0000000..517c3c6 --- /dev/null +++ b/examples/cxx/tree/wildcard/email.xml @@ -0,0 +1,32 @@ + + + + + + + Jane Doe <jane@doe.com> + John Doe <john@doe.com> + Surfing pictures + + +Hi Jane, + +Here are cool pictures of me surfing. + +Cheers, +John + + + YmFzZTY0IGJpbmFyeQ== + YmFzZTY0IGJpbmFyeQ== + + diff --git a/examples/cxx/tree/wildcard/email.xsd b/examples/cxx/tree/wildcard/email.xsd new file mode 100644 index 0000000..c14eebe --- /dev/null +++ b/examples/cxx/tree/wildcard/email.xsd @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cxx/tree/wildcard/makefile b/examples/cxx/tree/wildcard/makefile new file mode 100644 index 0000000..6a287e6 --- /dev/null +++ b/examples/cxx/tree/wildcard/makefile @@ -0,0 +1,72 @@ +# file : examples/cxx/tree/wildcard/makefile +# author : Boris Kolpackov +# 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 := email.xsd +cxx := driver.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd_options := --generate-inline \ +--generate-wildcard --generate-serialization --root-element message + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/xpath/README b/examples/cxx/tree/xpath/README new file mode 100644 index 0000000..48d40d6 --- /dev/null +++ b/examples/cxx/tree/xpath/README @@ -0,0 +1,47 @@ +This example shows how to use the C++/Tree mapping together with XPath. +In particular, it shows how to execute an XPath query on the underlying +DOM document and then handle the result using the more convenient object +model representation. For more information on maintaining association +with the underlying DOM document, refer to Section 5.1, "DOM Association" +in the C++/Tree Mapping User Manual. + +You will need the XQilla library[1] which provides XQuery and XPath 2 +support on top of Xerces-C++ in order to build and run this example. + +[1] http://xqilla.sourceforge.net + +The example consists of the following files: + +people.xsd + XML Schema definition for a simple person record vocabulary. + +people.xml + Sample XML instance document. + +people.hxx +people.cxx + C++ types that represent the person record vocabulary and a set of + parsing functions that convert XML instance documents to a tree-like + in-memory object model. These are generated by XSD from people.xsd. + +dom-parse.hxx +dom-parse.cxx + Definition and implementation of the parse() function that parses an + XML document to a DOM document. + +driver.cxx + Driver for Xerces-C++ 3.x.y/XQilla 2.2.x. It first calls the above + parse() function to parse the input file to a DOM document using + XQilla-provided DOM Implementation with support for XPath 2. It + then parses the DOM document to the object model. Finally, it + prepares and executes an XPath query on the underlying DOM + document and then handles the result by getting back from the + returned DOM nodes to object model nodes. + +driver-2.cxx + Driver for Xerces-C++ 2.x.y/XQilla 2.1.x. It performs the same set + of actions as driver.cxx above. + +To run the example on the sample XML document simply execute: + +$ ./driver people.xml diff --git a/examples/cxx/tree/xpath/dom-parse.cxx b/examples/cxx/tree/xpath/dom-parse.cxx new file mode 100644 index 0000000..84ff0af --- /dev/null +++ b/examples/cxx/tree/xpath/dom-parse.cxx @@ -0,0 +1,113 @@ +// file : examples/cxx/tree/xpath/dom-parse.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include "dom-parse.hxx" + +#include + +#include +#include + +#include +#include + +#include +#include + +using namespace xercesc; +namespace xml = xsd::cxx::xml; +namespace tree = xsd::cxx::tree; + +xml::dom::auto_ptr +parse (std::istream& is, + const std::string& id, + bool validate, + DOMImplementation* impl) +{ +#if _XERCES_VERSION >= 30000 + + // Xerces-C++ 3.0.0 and later. + // + xml::dom::auto_ptr 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); + + // We will release the DOM document ourselves. + // + conf->setParameter (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + // Set error handler. + // + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); + +#else // _XERCES_VERSION >= 30000 + + // Same as above but for Xerces-C++ 2 series. + // + xml::dom::auto_ptr parser ( + impl->createDOMBuilder (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + + parser->setFeature (XMLUni::fgDOMComments, false); + parser->setFeature (XMLUni::fgDOMDatatypeNormalization, true); + parser->setFeature (XMLUni::fgDOMEntities, false); + parser->setFeature (XMLUni::fgDOMNamespaces, true); + parser->setFeature (XMLUni::fgDOMWhitespaceInElementContent, false); + parser->setFeature (XMLUni::fgDOMValidation, validate); + parser->setFeature (XMLUni::fgXercesSchema, validate); + parser->setFeature (XMLUni::fgXercesSchemaFullChecking, false); + parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true); + + tree::error_handler eh; + xml::dom::bits::error_handler_proxy ehp (eh); + parser->setErrorHandler (&ehp); + +#endif // _XERCES_VERSION >= 30000 + + // Prepare input stream. + // + xml::sax::std_input_source isrc (is, id); + Wrapper4InputSource wrap (&isrc, false); + +#if _XERCES_VERSION >= 30000 + xml::dom::auto_ptr doc (parser->parse (&wrap)); +#else + xml::dom::auto_ptr doc (parser->parse (wrap)); +#endif + + eh.throw_if_failed > (); + + return doc; +} diff --git a/examples/cxx/tree/xpath/dom-parse.hxx b/examples/cxx/tree/xpath/dom-parse.hxx new file mode 100644 index 0000000..cfa1555 --- /dev/null +++ b/examples/cxx/tree/xpath/dom-parse.hxx @@ -0,0 +1,26 @@ +// file : examples/cxx/tree/xpath/dom-parse.hxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#ifndef DOM_PARSE +#define DOM_PARSE + +#include +#include + +#include +#include + +#include + +// 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::cxx::xml::dom::auto_ptr +parse (std::istream& is, + const std::string& id, + bool validate, + xercesc::DOMImplementation*); + +#endif // DOM_PARSE diff --git a/examples/cxx/tree/xpath/driver-2.cxx b/examples/cxx/tree/xpath/driver-2.cxx new file mode 100644 index 0000000..ccbdd7c --- /dev/null +++ b/examples/cxx/tree/xpath/driver-2.cxx @@ -0,0 +1,139 @@ +// file : examples/cxx/tree/xpath/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include +#include + +#include + +#include + +#include // xml::string, xml::transcode + +#include "dom-parse.hxx" + +#include "people.hxx" + +using namespace std; +using namespace xercesc; +namespace xml = xsd::cxx::xml; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " people.xml" << endl; + return 1; + } + + int r (0); + + // Initialise Xerces-C++ and XQilla. + // + XQillaPlatformUtils::initialize(); + + // Get the XQilla DOMImplementation object with support for XPath. + // + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation( + xml::string ("XPath2 3.0").c_str ())); + + try + { + using namespace people; + + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + // Parse the XML file to DOM using the XQilla DOMImplementation. + // + xml_schema::dom::auto_ptr dom ( + parse (ifs, argv[1], true, impl)); + + // Parse the DOM document to the object model. We also request that + // the DOM document to be associated with the object model. + // + std::auto_ptr d ( + directory_ (dom, + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); + + // Obtain the root element and document corresponding to the + // directory object. + // + DOMElement* root (static_cast (d->_node ())); + DOMDocument* doc (root->getOwnerDocument ()); + + // Obtain namespace resolver. + // + xml_schema::dom::auto_ptr resolver ( + (XQillaNSResolver*)doc->createNSResolver (root)); + + // Set the namespace prefix for the people namespace that we can + // use reliably in XPath expressions regardless of what is used + // in XML documents. + // + resolver->addNamespaceBinding ( + xml::string ("p").c_str (), + xml::string ("http://www.codesynthesis.com/people").c_str ()); + + // Create XPath expression. + // + xml_schema::dom::auto_ptr expr ( + static_cast ( + doc->createExpression ( + xml::string ("p:directory/person[age > 30]").c_str (), + resolver.get ()))); + + // Execute the query. + // + xml_schema::dom::auto_ptr r ( + static_cast ( + expr->evaluate (doc, XPath2Result::ITERATOR_RESULT, 0))); + + // Iterate over the result. + // + cout << "Records matching the query:" << endl; + + while (r->iterateNext ()) + { + const DOMNode* n (r->asNode ()); + + // Obtain the object model node corresponding to this DOM node. + // + person* p ( + static_cast ( + n->getUserData (xml_schema::dom::tree_node_key))); + + // Print the data using the object model. + // + cout << endl + << "First : " << p->first_name () << endl + << "Last : " << p->last_name () << endl + << "Gender : " << p->gender () << endl + << "Age : " << p->age () << endl; + } + } + catch(const DOMException& e) + { + cerr << xml::transcode (e.getMessage ()) << std::endl; + r = 1; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + XQillaPlatformUtils::terminate(); + return r; +} diff --git a/examples/cxx/tree/xpath/driver.cxx b/examples/cxx/tree/xpath/driver.cxx new file mode 100644 index 0000000..b55037b --- /dev/null +++ b/examples/cxx/tree/xpath/driver.cxx @@ -0,0 +1,137 @@ +// file : examples/cxx/tree/xpath/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include +#include +#include + +#include + +#include + +#include // xml::string, xml::transcode + +#include "dom-parse.hxx" + +#include "people.hxx" + +using namespace std; +using namespace xercesc; +namespace xml = xsd::cxx::xml; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " people.xml" << endl; + return 1; + } + + int r (0); + + // Initialise Xerces-C++ and XQilla. + // + XQillaPlatformUtils::initialize(); + + // Get the XQilla DOMImplementation object with support for XPath. + // + DOMImplementation* impl ( + DOMImplementationRegistry::getDOMImplementation( + xml::string ("XPath2 3.0").c_str ())); + + try + { + using namespace people; + + ifstream ifs; + ifs.exceptions (ifstream::badbit | ifstream::failbit); + ifs.open (argv[1]); + + // Parse the XML file to DOM using the XQilla DOMImplementation. + // + xml_schema::dom::auto_ptr dom ( + parse (ifs, argv[1], true, impl)); + + // Parse the DOM document to the object model. We also request that + // the DOM document to be associated with the object model. + // + std::auto_ptr d ( + directory_ (dom, + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); + + // Obtain the root element and document corresponding to the + // directory object. + // + DOMElement* root (static_cast (d->_node ())); + DOMDocument* doc (root->getOwnerDocument ()); + + // Obtain namespace resolver. + // + xml_schema::dom::auto_ptr resolver ( + doc->createNSResolver (root)); + + // Set the namespace prefix for the people namespace that we can + // use reliably in XPath expressions regardless of what is used + // in XML documents. + // + resolver->addNamespaceBinding ( + xml::string ("p").c_str (), + xml::string ("http://www.codesynthesis.com/people").c_str ()); + + // Create XPath expression. + // + xml_schema::dom::auto_ptr expr ( + doc->createExpression ( + xml::string ("p:directory/person[age > 30]").c_str (), + resolver.get ())); + + // Execute the query. + // + xml_schema::dom::auto_ptr r ( + expr->evaluate (doc, DOMXPathResult::ITERATOR_RESULT_TYPE, 0)); + + // Iterate over the result. + // + cout << "Records matching the query:" << endl; + + while (r->iterateNext ()) + { + DOMNode* n (r->getNodeValue ()); + + // Obtain the object model node corresponding to this DOM node. + // + person* p ( + static_cast ( + n->getUserData (xml_schema::dom::tree_node_key))); + + // Print the data using the object model. + // + cout << endl + << "First : " << p->first_name () << endl + << "Last : " << p->last_name () << endl + << "Gender : " << p->gender () << endl + << "Age : " << p->age () << endl; + } + } + catch(const DOMException& e) + { + cerr << xml::transcode (e.getMessage ()) << std::endl; + r = 1; + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + r = 1; + } + catch (const std::ios_base::failure&) + { + cerr << argv[1] << ": unable to open or read failure" << endl; + r = 1; + } + + XQillaPlatformUtils::terminate(); + return r; +} diff --git a/examples/cxx/tree/xpath/makefile b/examples/cxx/tree/xpath/makefile new file mode 100644 index 0000000..5e73cfb --- /dev/null +++ b/examples/cxx/tree/xpath/makefile @@ -0,0 +1,71 @@ +# file : examples/cxx/tree/xpath/makefile +# author : Boris Kolpackov +# 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 := people.xsd +cxx := driver.cxx dom-parse.cxx + +obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(xsd:.xsd=.o)) +dep := $(obj:.o=.o.d) + +driver := $(out_base)/driver +clean := $(out_base)/.clean + + +# Import. +# +$(call import,\ + $(scf_root)/import/libxerces-c/stub.make,\ + l: xerces_c.l,cpp-options: xerces_c.l.cpp-options) + +$(call import,\ + $(scf_root)/import/libxqilla/stub.make,\ + l: xqilla.l,cpp-options: xqilla.l.cpp-options) + + +# Build. +# +$(driver): $(obj) $(xqilla.l) $(xerces_c.l) + +$(obj) $(dep): cpp_options := -I$(src_root)/libxsd +$(obj) $(dep): $(xqilla.l.cpp-options) $(xerces_c.l.cpp-options) + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): xsd := $(out_root)/xsd/xsd + +$(out_base)/$(xsd:.xsd=.hxx) \ +$(out_base)/$(xsd:.xsd=.ixx) \ +$(out_base)/$(xsd:.xsd=.cxx): $(out_root)/xsd/xsd + +$(call include-dep,$(dep)) + +# Convenience alias for default target. +# +.PHONY: $(out_base)/ +$(out_base)/: $(driver) + + +# Clean. +# +.PHONY: $(clean) + +$(clean): $(driver).o.clean \ + $(addsuffix .cxx.clean,$(obj)) \ + $(addsuffix .cxx.clean,$(dep)) \ + $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) + + +# 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)/xsd/tree/xsd-cxx.make) + +# Dependencies. +# +$(call import,$(src_root)/xsd/makefile) diff --git a/examples/cxx/tree/xpath/people.xml b/examples/cxx/tree/xpath/people.xml new file mode 100644 index 0000000..24af876 --- /dev/null +++ b/examples/cxx/tree/xpath/people.xml @@ -0,0 +1,29 @@ + + + + + + + + John + Doe + male + 32 + + + + Jane + Doe + female + 28 + + + diff --git a/examples/cxx/tree/xpath/people.xsd b/examples/cxx/tree/xpath/people.xsd new file mode 100644 index 0000000..12c8aef --- /dev/null +++ b/examples/cxx/tree/xpath/people.xsd @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1