From ac0ec9b7689393e5e549c08765ca736c673c54bb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Nov 2013 08:55:22 +0200 Subject: Drop support for Berkeley DB XML --- examples/cxx/tree/README | 4 - 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 | 107 ---------------------- examples/cxx/tree/makefile | 6 +- 6 files changed, 1 insertion(+), 411 deletions(-) delete mode 100644 examples/cxx/tree/dbxml/README delete mode 100644 examples/cxx/tree/dbxml/driver.cxx delete mode 100644 examples/cxx/tree/dbxml/library.xsd delete mode 100644 examples/cxx/tree/dbxml/makefile (limited to 'examples') diff --git a/examples/cxx/tree/README b/examples/cxx/tree/README index 348885f..ee91b43 100644 --- a/examples/cxx/tree/README +++ b/examples/cxx/tree/README @@ -74,7 +74,3 @@ compression 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/dbxml/README b/examples/cxx/tree/dbxml/README deleted file mode 100644 index 59e67d0..0000000 --- a/examples/cxx/tree/dbxml/README +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index 56cbb4a..0000000 --- a/examples/cxx/tree/dbxml/driver.cxx +++ /dev/null @@ -1,175 +0,0 @@ -// 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 deleted file mode 100644 index c71c312..0000000 --- a/examples/cxx/tree/dbxml/library.xsd +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cxx/tree/dbxml/makefile b/examples/cxx/tree/dbxml/makefile deleted file mode 100644 index a27088c..0000000 --- a/examples/cxx/tree/dbxml/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : examples/cxx/tree/dbxml/makefile -# author : Boris Kolpackov -# copyright : Copyright (c) 2005-2011 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 -install := $(out_base)/.install -dist := $(out_base)/.dist -dist-win := $(out_base)/.dist-win -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) - -ifeq ($(filter $(MAKECMDGOALS),dist dist-win install),) -$(call import,\ - $(scf_root)/import/libdbxml/stub.make,\ - l: dbxml.l,cpp-options: dbxml.l.cpp-options) -endif - - -# 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) - -genf := $(xsd:.xsd=.hxx) $(xsd:.xsd=.ixx) $(xsd:.xsd=.cxx) -gen := $(addprefix $(out_base)/,$(genf)) - -$(gen): xsd := $(out_root)/xsd/xsd -$(gen): xsd_options := --generate-serialization --generate-ostream -$(gen): $(out_root)/xsd/xsd - -$(call include-dep,$(dep)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - - -# Install & Dist. -# -dist-common := $(out_base)/.dist-common - -$(install) $(dist) $(dist-win) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) - -$(install): - $(call install-data,$(src_base)/README,$(install_doc_dir)/xsd/$(path)/README) - $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/xsd/$(path)/driver.cxx) - $(call install-data,$(src_base)/library.xsd,$(install_doc_dir)/xsd/$(path)/library.xsd) - -$(dist-common): - $(call install-data,$(src_base)/driver.cxx,$(dist_prefix)/$(path)/driver.cxx) - $(call install-data,$(src_base)/library.xsd,$(dist_prefix)/$(path)/library.xsd) - -$(dist): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README) - -$(dist-win): $(dist-common) - $(call install-data,$(src_base)/README,$(dist_prefix)/$(path)/README.txt) - $(call message,,unix2dos $(dist_prefix)/$(path)/README.txt) - - -# Clean. -# -$(clean): $(driver).o.clean \ - $(addsuffix .cxx.clean,$(obj)) \ - $(addsuffix .cxx.clean,$(dep)) \ - $(addprefix $(out_base)/,$(xsd:.xsd=.cxx.xsd.clean)) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(gen): | $(out_base)/.gitignore -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/cxx/o-e.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/install.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 index fcf6db3..2532acb 100644 --- a/examples/cxx/tree/makefile +++ b/examples/cxx/tree/makefile @@ -7,7 +7,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make all_examples := binary caching embedded custom hello library messaging \ mixed multiroot performance polymorphism streaming wildcard compression \ -dbxml xpath +xpath build_examples := binary caching embedded custom hello library messaging \ @@ -17,10 +17,6 @@ ifeq ($(xsd_with_zlib),y) build_examples += compression endif -ifeq ($(xsd_with_dbxml),y) -build_examples += dbxml -endif - ifeq ($(xsd_with_xqilla),y) build_examples += xpath endif -- cgit v1.1