diff options
Diffstat (limited to 'documentation/cxx/tree')
l--------- | documentation/cxx/tree/dbxml/driver.cxx | 1 | ||||
-rw-r--r-- | documentation/cxx/tree/dbxml/index.xhtml | 348 | ||||
l--------- | documentation/cxx/tree/dbxml/library.xsd | 1 | ||||
-rw-r--r-- | documentation/cxx/tree/guide/index.xhtml | 27 | ||||
-rw-r--r-- | documentation/cxx/tree/makefile | 2 | ||||
-rw-r--r-- | documentation/cxx/tree/manual/index.xhtml | 4 |
6 files changed, 11 insertions, 372 deletions
diff --git a/documentation/cxx/tree/dbxml/driver.cxx b/documentation/cxx/tree/dbxml/driver.cxx deleted file mode 120000 index 54d4313..0000000 --- a/documentation/cxx/tree/dbxml/driver.cxx +++ /dev/null @@ -1 +0,0 @@ -../../../../examples/cxx/tree/dbxml/driver.cxx
\ No newline at end of file diff --git a/documentation/cxx/tree/dbxml/index.xhtml b/documentation/cxx/tree/dbxml/index.xhtml deleted file mode 100644 index dc88083..0000000 --- a/documentation/cxx/tree/dbxml/index.xhtml +++ /dev/null @@ -1,348 +0,0 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> - -<head> - <title>C++/Tree Mapping and Berkeley DB XML Integration Guide</title> - - <meta name="copyright" content="© 2006-2011 Code Synthesis Tools CC"/> - <meta name="keywords" content="xsd,xml,schema,c++,mapping,data,binding,berkeley,db,dbxml"/> - <meta name="description" content="C++/Tree Mapping and Berkeley DB XML Integration Guide"/> - - <link rel="stylesheet" type="text/css" href="../../../default.css" /> - -<style type="text/css"> - pre { - background : #cde8f6; - - padding : 0 0 0 1em; - margin : 2em 0em 2em 0; - - } - - h1 {padding-top: 1em;} - -</style> -</head> - -<body> -<div id="container"> - <div id="content"> - - <h1>Introduction</h1> - - <p>This guide shows how to integrate the - <a href="http://www.codesynthesis.com/products/xsd/c++/tree/">C++/Tree</a> - mapping generated by - <a href="http://www.codesynthesis.com/products/xsd/">CodeSynthesis XSD</a> - with - <a href="http://www.oracle.com/database/berkeley-db/xml/index.html">Berkeley DB XML</a>. - - Berkeley DB XML is an embedded XML database which allows efficient - storage and query of XML instance documents. - - CodeSynthesis XSD is a W3C XML Schema to C++ data binding compiler. - - The C++/Tree mapping allows you to manipulate the data stored in XML - using objects that semantically correspond to your application - domain rather than dealing with direct representations of XML. - - For an introduction to - the Berkeley DB XML refer to the - <a href="http://www.oracle.com/database/berkeley-db/xml/index.html">Berkeley DB XML - Getting Started Guide</a>. - For an introduction to the C++/Tree mapping refer to - the <a href="../guide/">C++/Tree Mapping Getting Started Guide</a>. - </p> - - - <p>This guide describes the following four operations:</p> - - <ul> - <li>Create a new document in DB from an object model</li> - <li>Create an object model from a document in DB</li> - <li>Create an object model from a document fragment in DB</li> - <li>Update a document fragment in DB from an object model</li> - </ul> - - <p>Our examples will be based on simple XML for book library. The XML - Schema definition for the library is in - <a href="./library.xsd">library.xsd</a> and is compiled by XSD - to obtain <code>library.hxx</code> and <code>library.cxx</code>. - All C++ code fragments that are presented in this guide are available - as a single program in <a href="./driver.cxx">driver.cxx</a>. - The complete example is available in the - <code>examples/cxx/tree/dbxml</code> directory of the XSD distribution.</p> - - <p>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 <code>DBXML_DOM</code> macro defined in - order to avoid using unsupported parts of the API. - </p> - - <p>A sample XML document for the library schema is presented below:</p> - - <pre> -<lib:catalog xmlns:lib="http://www.codesynthesis.com/library"> - <book available="true" id="ES"> - <isbn>20530902</isbn> - <title>The Elements of Style</title> - <genre>reference</genre> - - <author> - <name>William Strunk, Jr.</name> - <born>1869-07-01</born> - <died>1946-09-26</died> - </author> - - <author> - <name>E.B. White</name> - <born>1899-07-11</born> - <died>1985-10-01</died> - </author> - </book> -</lib:catalog> - </pre> - - <h1>Create Document from Object Model</h1> - - <p>In this step, we will programmatically create a book catalog - with one book, save it into an <code>XmlDocument</code> object - using one of the serialization functions generated by XSD ( - <code>catalog_</code> in our case), and store the - <code>XmlDocument</code> object as a new document in the - DB container:</p> - - <pre> -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 catalog with one book. -// -catalog c; - -book b (20530902, // ISBN - title ("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); - </pre> - - <p>If we now resolve the <code>new.xml</code> in the container and - print its content, we will get:</p> - - <pre> -<lib:catalog xmlns:lib="http://www.codesynthesis.com/library"> - <book available="true" id="ES"> - <isbn>20530902</isbn> - <title>The Elements of Style</title> - <genre>reference</genre> - <author> - <name>William Strunk, Jr.</name> - <born>1869-07-01</born> - <died>1946-09-26</died> - </author> - </book> -</lib:catalog> - </pre> - - <h1>Create Object Model from Document</h1> - - <p>Creating an object model from a document is a matter - of obtaining <code>XmlDocument</code> object and passing its DOM - representation to one of the parsing functions generated by XSD - (<code>catalog_</code> in our case): - </p> - - <pre> -// 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<catalog> c (catalog_ (*doc.getContentAsDOM (), - xml_schema::flags::dont_initialize)); - -cerr << *c << endl; - </pre> - - <p>This code fragment prints:</p> - - <pre> -book: -isbn: 20530902 -title: The Elements of Style -genre: reference -author: -name: William Strunk, Jr. -born: 1869-07-01 -died: 1946-09-26 -available: 1 -id: ES - </pre> - - <h1>Create Object Model from Document Fragment</h1> - - <p>The following code fragment looks up the book with id <code>"ES"</code> - using XQuery. It then creates a <code>book</code> object from the - resulting <code>XmlValue</code>:</p> - - <pre> -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<book> b ( - new book ( - *static_cast<xercesc::DOMElement*> (v.asNode ()))); - - cerr << *b << endl; -} - </pre> - -<p>This code fragment prints:</p> - - <pre> -isbn: 20530902 -title: The Elements of Style -genre: reference -author: -name: William Strunk, Jr. -born: 1869-07-01 -died: 1946-09-26 -available: 1 -id: ES - </pre> - - <p>Note that we had to perform a <code>static_cast</code> from - <code>xercesc::DOMNode</code> - returned by the <code>XmlValue::asNode</code> member function to - <code>xercesc::DOMElement</code>. This is safe since we know - that in our schema books are represented as XML elements.</p> - - <h1>Update Document Fragment from Object Model</h1> - - <p>Analogous to the create case, the following code fragment looks - up the book with id <code>"ES"</code> using XQuery. It then creates - a <code>book</code> object from the resulting <code>XmlValue</code>, - adds another author, changes the availability status, and saves - the changes back to the <code>XmlValue</code> object: - </p> - - <pre> -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<book> b ( - new book ( - *static_cast<xercesc::DOMElement*> (v.asNode ()))); - - // 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<xercesc::DOMElement*> (v.asNode ()) << *b; - - // Update the document in the container. - // - XmlDocument doc (v.asDocument ()); - container.updateDocument (doc, update_context); -} - </pre> - - <p>If we now resolve the <code>new.xml</code> in the container and - print its content, we will get:</p> - - <pre> -<lib:catalog xmlns:lib="http://www.codesynthesis.com/library"> - <book available="false" id="ES"> - <isbn>20530902</isbn> - <title>The Elements of Style</title> - <genre>reference</genre> - <author> - <name>William Strunk, Jr.</name> - <born>1869-07-01</born> - <died>1946-09-26</died> - </author> - <author> - <name>E.B. White</name> - <born>1899-07-11</born> - <died>1985-10-01</died> - </author> - </book> -</lib:catalog> - </pre> - - </div> - <div id="footer"> - ©2006-2011 <a href="http://www.codesynthesis.com">CODE SYNTHESIS TOOLS CC</a> - - <div id="terms"> - Permission is granted to copy, distribute and/or modify this - document under the terms of the - <a href="http://www.codesynthesis.com/licenses/fdl-1.2.txt">GNU Free - Documentation License, version 1.2</a>; with no Invariant Sections, - no Front-Cover Texts and no Back-Cover Texts. - </div> - </div> - -</div> - -</body> -</html> diff --git a/documentation/cxx/tree/dbxml/library.xsd b/documentation/cxx/tree/dbxml/library.xsd deleted file mode 120000 index 636c490..0000000 --- a/documentation/cxx/tree/dbxml/library.xsd +++ /dev/null @@ -1 +0,0 @@ -../../../../examples/cxx/tree/dbxml/library.xsd
\ No newline at end of file diff --git a/documentation/cxx/tree/guide/index.xhtml b/documentation/cxx/tree/guide/index.xhtml index 4f76818..7d2ac54 100644 --- a/documentation/cxx/tree/guide/index.xhtml +++ b/documentation/cxx/tree/guide/index.xhtml @@ -298,9 +298,6 @@ <li><a href="http://wiki.codesynthesis.com/Tree/Customization_guide">C++/Tree Mapping Customization Guide</a></li> - <li><a href="http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/dbxml/">C++/Tree - Mapping and Berkeley DB XML Integration Guide</a></li> - <li><a href="http://wiki.codesynthesis.com/Tree/FAQ">C++/Tree Mapping Frequently Asked Questions (FAQ)</a></li> @@ -318,7 +315,6 @@ mailing list is the place to ask technical questions about XSD and the C++/Parser mapping. Furthermore, the <a href="http://www.codesynthesis.com/pipermail/xsd-users/">archives</a> may already have answers to some of your questions.</li> - </ul> <!-- Introduction --> @@ -344,18 +340,17 @@ mapping elements that can be useful in some applications. These include serialization and extraction to/from formats others than XML, such as unstructured text (useful for debugging) and binary - representations such as XDR and CDR for high-speed data processing, - integration with XML databases such as Berkeley DB XML, and automatic - documentation generation. The C++/Tree mapping also provides a wide - range of mechanisms for controlling and customizing the generated - code.</p> - - <p>A typical application that uses C++/Tree for XML processing usually - performs the following three steps: it first reads (parses) an XML - document to an in-memory object model, it then performs some useful - computations on that object model which may involve modification - of the model, and finally it may write (serialize) the modified - object model back to XML.</p> + representations such as XDR and CDR for high-speed data processing + as well as automatic documentation generation. The C++/Tree mapping + also provides a wide range of mechanisms for controlling and + customizing the generated code.</p> + + <p>A typical application that uses C++/Tree for XML processing usually + performs the following three steps: it first reads (parses) an XML + document to an in-memory object model, it then performs some useful + computations on that object model which may involve modification + of the model, and finally it may write (serialize) the modified + object model back to XML.</p> <p>The next chapter presents a simple application that performs these three steps. The following chapters show how to use the C++/Tree diff --git a/documentation/cxx/tree/makefile b/documentation/cxx/tree/makefile index 5ca3924..e14bf68 100644 --- a/documentation/cxx/tree/makefile +++ b/documentation/cxx/tree/makefile @@ -25,11 +25,9 @@ $(install): path := $(subst $(src_root)/documentation/,,$(src_base)) $(dist-common): path := $(subst $(src_root)/,,$(src_base)) $(install): $(addprefix $(out_base)/,$(addsuffix /.install,$(docs))) - $(call install-dir,$(src_base)/dbxml,$(install_doc_dir)/xsd/$(path)/dbxml) $(call install-dir,$(src_base)/reference,$(install_doc_dir)/xsd/$(path)/reference) $(dist-common): - $(call install-dir,$(src_base)/dbxml,$(dist_prefix)/$(path)/dbxml) $(call install-dir,$(src_base)/reference,$(dist_prefix)/$(path)/reference) $(dist): $(dist-common) $(addprefix $(out_base)/,$(addsuffix /.dist,$(docs))) diff --git a/documentation/cxx/tree/manual/index.xhtml b/documentation/cxx/tree/manual/index.xhtml index eb41bb8..d022919 100644 --- a/documentation/cxx/tree/manual/index.xhtml +++ b/documentation/cxx/tree/manual/index.xhtml @@ -460,9 +460,6 @@ <li><a href="http://wiki.codesynthesis.com/Tree/Customization_guide">C++/Tree Mapping Customization Guide</a></li> - <li><a href="http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/dbxml/">C++/Tree - Mapping and Berkeley DB XML Integration Guide</a></li> - <li><a href="http://wiki.codesynthesis.com/Tree/FAQ">C++/Tree Mapping Frequently Asked Questions (FAQ)</a></li> @@ -480,7 +477,6 @@ mailing list is a place to ask questions. Furthermore the <a href="http://www.codesynthesis.com/pipermail/xsd-users/">archives</a> may already have answers to some of your questions.</li> - </ul> |