summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xsd/doc/cxx/parser/guide/index.xhtml.in68
-rw-r--r--xsd/doc/cxx/tree/guide/index.xhtml.in150
-rw-r--r--xsd/doc/cxx/tree/manual/index.xhtml.in264
3 files changed, 249 insertions, 233 deletions
diff --git a/xsd/doc/cxx/parser/guide/index.xhtml.in b/xsd/doc/cxx/parser/guide/index.xhtml.in
index a72b06e..96d06e2 100644
--- a/xsd/doc/cxx/parser/guide/index.xhtml.in
+++ b/xsd/doc/cxx/parser/guide/index.xhtml.in
@@ -350,12 +350,14 @@
<li><a href="https://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml">XSD
Compiler Command Line Manual</a></li>
- <li>The <code>examples/cxx/parser/</code> directory in the XSD
- distribution contains a collection of examples and a README
- file with an overview of each example.</li>
+ <li>The <code>cxx/parser/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ contains a collection of examples and a README file with an overview
+ of each example.</li>
- <li>The <code>README</code> file in the XSD distribution explains
- how to compile the examples on various platforms.</li>
+ <li>The <code>README</code> file in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ explains how to build the examples.</li>
<li>The <a href="https://www.codesynthesis.com/mailman/listinfo/xsd-users">xsd-users</a>
mailing list is the place to ask technical questions about XSD and the C++/Parser mapping.
@@ -481,8 +483,9 @@
<p>In this chapter we will examine how to parse a very simple XML
document using the XSD-generated C++/Parser skeletons.
The code presented in this chapter is based on the <code>hello</code>
- example which can be found in the <code>examples/cxx/parser/</code>
- directory of the XSD distribution.</p>
+ example which can be found in the <code>cxx/parser/</code> directory in
+ the <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<h2><a name="2.1">2.1 Writing XML Document and Schema</a></h2>
@@ -550,7 +553,7 @@
</p>
<pre class="terminal">
-$ xsd cxx-parser --xml-parser expat hello.xsd
+$ xsd cxx-parser --std c++11 --xml-parser expat hello.xsd
</pre>
<p>The <code>--xml-parser</code> option indicates that we want to
@@ -754,8 +757,8 @@ main (int argc, char* argv[])
on these options refer to the
<a href="https://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml">XSD
Compiler Command Line Manual</a>. The <code>'generated'</code> example
- in the XSD distribution shows the sample implementation generation
- feature in action.</p>
+ in the <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ shows the sample implementation generation feature in action.</p>
<h2><a name="2.4">2.4 Compiling and Running</a></h2>
@@ -767,8 +770,8 @@ main (int argc, char* argv[])
</p>
<pre class="terminal">
-$ c++ -I.../libxsd -c driver.cxx hello-pskel.cxx
-$ c++ -o driver driver.o hello-pskel.o -lexpat
+$ c++ -std=c++11 -I.../libxsd -c driver.cxx hello-pskel.cxx
+$ c++ -std=c++11 -o driver driver.o hello-pskel.o -lexpat
$ ./driver hello.xml
Hello, sun!
Hello, moon!
@@ -776,9 +779,10 @@ Hello, world!
</pre>
<p>Here <code>.../libxsd</code> represents the path to the
- <code>libxsd</code> directory in the XSD distribution.
- We can also test the error handling. To test XML well-formedness
- checking, we can try to parse <code>hello-pskel.hxx</code>:</p>
+ <a href="https://cppget.org/libxsd">libxsd</a> package root
+ directory. We can also test the error handling. To test XML
+ well-formedness checking, we can try to parse
+ <code>hello-pskel.hxx</code>:</p>
<pre class="terminal">
$ ./driver hello-pskel.hxx
@@ -1490,7 +1494,7 @@ gender ::gender ::gender;
option to let the XSD compiler know about our type map:</p>
<pre class="terminal">
-$ xsd cxx-parser --type-map people.map people.xsd
+$ xsd cxx-parser --std c++11 --type-map people.map people.xsd
</pre>
<p>If we now look at the generated <code>people-pskel.hxx</code>,
@@ -1618,9 +1622,9 @@ namespace http://www.example.com/xmlns/my
<code>std::wstring</code> depending on the character type
selected (see <a href="#5.2"> Section 5.2, "Character Type and
Encoding"</a> for more information). The binary XML Schema
- types are mapped to either <code>std::auto_ptr&lt;xml_schema::buffer></code>
- or <code>std::unique_ptr&lt;xml_schema::buffer></code>
- depending on the C++ standard selected (C++98 or C++11,
+ types are mapped to either <code>std::unique_ptr&lt;xml_schema::buffer></code>
+ or <code>std::auto_ptr&lt;xml_schema::buffer></code>
+ depending on the C++ standard selected (C++11 or C++98,
respectively; refer to the <code>--std</code> XSD compiler
command line option for details).</p>
@@ -1738,7 +1742,8 @@ people ::people;
recompile our schema and move on to implementing the parsers:</p>
<pre class="terminal">
-$ xsd cxx-parser --xml-parser expat --type-map people.map people.xsd
+$ xsd cxx-parser --std c++11 --xml-parser expat --type-map people.map \
+ people.xsd
</pre>
<p>Here is the implementation of our three parsers in full. One
@@ -1882,8 +1887,8 @@ main (int argc, char* argv[])
<pre class="terminal">
-$ c++ -I.../libxsd -c driver.cxx people-pskel.cxx
-$ c++ -o driver driver.o people-pskel.o -lexpat
+$ c++ -std=c++11 -I.../libxsd -c driver.cxx people-pskel.cxx
+$ c++ -std=c++11 -o driver driver.o people-pskel.o -lexpat
$ ./driver people.xml
first: John
last: Doe
@@ -1917,12 +1922,12 @@ age: 28
<h2><a name="5.1">5.1 C++ Standard</a></h2>
- <p>The C++/Parser mapping provides support for ISO/IEC C++ 1998/2003 (C++98)
- and ISO/IEC C++ 2011 (C++11). To select the C++ standard for the
+ <p>The C++/Parser mapping provides support for ISO/IEC C++ 2011 (C++11)
+ and ISO/IEC C++ 1998/2003 (C++98). To select the C++ standard for the
generated code we use the <code>--std</code> XSD compiler command
line option. While the majority of the examples in this guide use
- C++98, support for the new functionality and library components
- introduced in C++11 are discussed throughout the document.</p>
+ C++11, the document explains the C++11/98 usage difference and so
+ they can easily be converted to C++98.</p>
<h2><a name="5.2">5.2 Character Type and Encoding</a></h2>
@@ -2354,9 +2359,10 @@ private:
<p>Most of code presented in this section is taken from the
<code>polymorphism</code> example which can be found in the
- <code>examples/cxx/parser/</code> directory of the XSD distribution.
- Handling of <code>xsi:type</code> and substitution groups when used
- on root elements requires a number of special actions as shown in
+ <code>cxx/parser/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package.
+ Handling of <code>xsi:type</code> and substitution groups when used on
+ root elements requires a number of special actions as shown in
the <code>polyroot</code> example.</p>
@@ -2754,8 +2760,8 @@ namespace xml_schema
<p>The return type of the <code>base64_binary_pimpl</code> and
<code>hex_binary_pimpl</code> parser implementations is either
- <code>std::auto_ptr&lt;xml_schema::buffer></code> (C++98) or
- <code>std::unique_ptr&lt;xml_schema::buffer></code> (C++11),
+ <code>std::unique_ptr&lt;xml_schema::buffer></code> (C++11) or
+ <code>std::auto_ptr&lt;xml_schema::buffer></code> (C++98),
depending on the C++ standard selected (<code>--std</code> XSD
compiler option). The <code>xml_schema::buffer</code> type
represents a binary buffer and its interface is presented below.</p>
diff --git a/xsd/doc/cxx/tree/guide/index.xhtml.in b/xsd/doc/cxx/tree/guide/index.xhtml.in
index e1bb36e..b704e50 100644
--- a/xsd/doc/cxx/tree/guide/index.xhtml.in
+++ b/xsd/doc/cxx/tree/guide/index.xhtml.in
@@ -305,12 +305,14 @@
<li><a href="https://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml">XSD
Compiler Command Line Manual</a></li>
- <li>The <code>examples/cxx/tree/</code> directory in the XSD
- distribution contains a collection of examples and a README
- file with an overview of each example.</li>
+ <li>The <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ contains a collection of examples and a README file with an overview
+ of each example.</li>
- <li>The <code>README</code> file in the XSD distribution explains
- how to compile the examples on various platforms.</li>
+ <li>The <code>README</code> file in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ explains how to build the examples.</li>
<li>The <a href="https://www.codesynthesis.com/mailman/listinfo/xsd-users">xsd-users</a>
mailing list is the place to ask technical questions about XSD and the C++/Parser mapping.
@@ -446,8 +448,8 @@
serialize a very simple XML document using the XSD-generated
C++/Tree object model. The code presented in this chapter is
based on the <code>hello</code> example which can be found in
- the <code>examples/cxx/tree/</code> directory of the XSD
- distribution.</p>
+ the <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package.</p>
<h2><a name="2.1">2.1 Writing XML Document and Schema</a></h2>
@@ -534,7 +536,7 @@
</p>
<pre class="terminal">
-$ xsd cxx-tree hello.xsd
+$ xsd cxx-tree --std c++11 hello.xsd
</pre>
<p>The XSD compiler produces two C++ files: <code>hello.hxx</code> and
@@ -584,10 +586,10 @@ public:
};
-std::auto_ptr&lt;hello_t>
+std::unique_ptr&lt;hello_t>
hello (const std::string&amp; uri);
-std::auto_ptr&lt;hello_t>
+std::unique_ptr&lt;hello_t>
hello (std::istream&amp;);
</pre>
@@ -625,22 +627,22 @@ hello (std::istream&amp;);
with the <code>--root-element-*</code> options). Parsing
functions return a dynamically allocated object model as an
automatic pointer. The actual pointer used depends on the
- C++ standard selected. For C++98 it is <code>std::auto_ptr</code>
- as shown above. For C++11 it is <code>std::unique_ptr</code>.
+ C++ standard selected. For C++11 it is <code>std::unique_ptr</code>
+ as shown above. For C++98 it is <code>std::auto_ptr</code>.
For example, if we modify our XSD compiler invocation to
- select C++11:</p>
+ select C++98:</p>
<pre class="terminal">
-$ xsd cxx-tree --std c++11 hello.xsd
+$ xsd cxx-tree hello.xsd
</pre>
<p>Then the parsing function signatures will become:</p>
<pre class="c++">
-std::unique_ptr&lt;hello_t>
+std::auto_ptr&lt;hello_t>
hello (const std::string&amp; uri);
-std::unique_ptr&lt;hello_t>
+std::auto_ptr&lt;hello_t>
hello (std::istream&amp;);
</pre>
@@ -664,7 +666,7 @@ main (int argc, char* argv[])
{
try
{
- auto_ptr&lt;hello_t> h (hello (argv[1]));
+ unique_ptr&lt;hello_t> h (hello (argv[1]));
for (hello_t::name_const_iterator i (h->name ().begin ());
i != h->name ().end ();
@@ -701,8 +703,8 @@ main (int argc, char* argv[])
</p>
<pre class="terminal">
-$ c++ -I.../libxsd -c driver.cxx hello.cxx
-$ c++ -o driver driver.o hello.o -lxerces-c
+$ c++ -std=c++11 -I.../libxsd -c driver.cxx hello.cxx
+$ c++ -std=c++11 -o driver driver.o hello.o -lxerces-c
$ ./driver hello.xml
Hello, sun!
Hello, moon!
@@ -710,10 +712,10 @@ Hello, world!
</pre>
<p>Here <code>.../libxsd</code> represents the path to the
- <code>libxsd</code> directory in the XSD distribution.
- Note also that we are required to link our application
- with the Xerces-C++ library because the generated code
- uses it as the underlying XML parser.</p>
+ <a href="https://cppget.org/libxsd">libxsd</a> package root
+ directory. Note also that we are required to link our
+ application with the Xerces-C++ library because the generated
+ code uses it as the underlying XML parser.</p>
<h2><a name="2.5">2.5 Adding Serialization</a></h2>
@@ -724,7 +726,7 @@ Hello, world!
it with the <code>--generate-serialization</code> options:</p>
<pre class="terminal">
-$ xsd cxx-tree --generate-serialization hello.xsd
+$ xsd cxx-tree --std c++11 --generate-serialization hello.xsd
</pre>
<p>If we now examine the generated <code>hello.hxx</code> file,
@@ -760,7 +762,7 @@ main (int argc, char* argv[])
{
try
{
- auto_ptr&lt;hello_t> h (hello (argv[1]));
+ unique_ptr&lt;hello_t> h (hello (argv[1]));
// Change the greeting phrase.
//
@@ -909,7 +911,7 @@ main (int argc, char* argv[])
change the type naming scheme:</p>
<pre class="terminal">
-$ xsd cxx-tree --type-naming ucc hello.xsd
+$ xsd cxx-tree --std c++11 --type-naming ucc hello.xsd
</pre>
<p>The <code>ucc</code> argument to the <code>--type-naming</code>
@@ -959,10 +961,10 @@ public:
};
-std::auto_ptr&lt;Hello_t>
+std::unique_ptr&lt;Hello_t>
hello (const std::string&amp; uri);
-std::auto_ptr&lt;Hello_t>
+std::unique_ptr&lt;Hello_t>
hello (std::istream&amp;);
</pre>
@@ -976,7 +978,8 @@ hello (std::istream&amp;);
<code>--type-regex</code> option:</p>
<pre class="terminal">
-$ xsd cxx-tree --type-naming ucc --type-regex '/ (.+)_t/\u$1/' hello.xsd
+$ xsd cxx-tree --std c++11 --type-naming ucc \
+ --type-regex '/ (.+)_t/\u$1/' hello.xsd
</pre>
<p>This results in the following changes to the generated code:</p>
@@ -1022,10 +1025,10 @@ public:
};
-std::auto_ptr&lt;Hello>
+std::unique_ptr&lt;Hello>
hello (const std::string&amp; uri);
-std::auto_ptr&lt;Hello>
+std::unique_ptr&lt;Hello>
hello (std::istream&amp;);
</pre>
@@ -1111,7 +1114,8 @@ hello (std::istream&amp;);
our schema with the <code>--generate-doxygen</code> option:</p>
<pre class="terminal">
-$ xsd cxx-tree --generate-serialization --generate-doxygen hello.xsd
+$ xsd cxx-tree --std c++11 --generate-serialization --generate-doxygen \
+ hello.xsd
</pre>
<p>Now the generated <code>hello.hxx</code> file contains comments
@@ -1167,12 +1171,12 @@ $ doxygen hello.doxygen
<h2><a name="3.1">3.1 C++ Standard</a></h2>
- <p>The C++/Tree mapping provides support for ISO/IEC C++ 1998/2003 (C++98)
- and ISO/IEC C++ 2011 (C++11). To select the C++ standard for the
+ <p>The C++/Tree mapping provides support for ISO/IEC C++ 2011 (C++11)
+ and ISO/IEC C++ 1998/2003 (C++98). To select the C++ standard for the
generated code we use the <code>--std</code> XSD compiler command
line option. While the majority of the examples in this guide use
- C++98, support for the new functionality and library components
- introduced in C++11 are discussed throughout the document.</p>
+ C++11, the document explains the C++11/98 usage difference and so
+ they can easily be converted to C++98.</p>
<h2><a name="3.2">3.2 Character Type and Encoding</a></h2>
@@ -1600,7 +1604,7 @@ using namespace std;
int
main ()
{
- auto_ptr&lt;people_t> ppl (people ("people.xml"));
+ unique_ptr&lt;people_t> ppl (people ("people.xml"));
// Iterate over individual person records.
//
@@ -1681,7 +1685,7 @@ using namespace std;
int
main ()
{
- auto_ptr&lt;people_t> ppl (people ("people.xml"));
+ unique_ptr&lt;people_t> ppl (people ("people.xml"));
// Iterate over individual person records and increment
// the age.
@@ -1873,16 +1877,6 @@ ps.push_back (jane);
of the passed objects:</p>
<pre class="c++">
-// Add the John Doe record. C++98 version.
-//
-auto_ptr&lt;person_t> john_p (
- new person_t ("John", // first-name
- "Doe", // last-name
- gender_t::male, // gender
- 32, // age
- 1));
-ps.push_back (john_p); // assumes ownership
-
// Add the Jane Doe record. C++11 version
//
unique_ptr&lt;person_t> jane_p (
@@ -1892,6 +1886,16 @@ unique_ptr&lt;person_t> jane_p (
28, // age
2)); // id
ps.push_back (std::move (jane_p)); // assumes ownership
+
+// Add the John Doe record. C++98 version.
+//
+auto_ptr&lt;person_t> john_p (
+ new person_t ("John", // first-name
+ "Doe", // last-name
+ gender_t::male, // gender
+ 32, // age
+ 1));
+ps.push_back (john_p); // assumes ownership
</pre>
<p>For more information on the non-copying modifier functions refer to
@@ -2265,17 +2269,17 @@ ps.push_back (std::move (jane_p)); // assumes ownership
on the following three parsing functions:</p>
<pre class="c++">
-std::[auto|unique]_ptr&lt;people_t>
+std::[unique|auto]_ptr&lt;people_t>
people (const std::string&amp; uri,
xml_schema::flags f = 0,
const xml_schema::properties&amp; p = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;people_t>
+std::[unique|auto]_ptr&lt;people_t>
people (std::istream&amp; is,
xml_schema::flags f = 0,
const xml_schema::properties&amp; p = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;people_t>
+std::[unique|auto]_ptr&lt;people_t>
people (std::istream&amp; is,
const std::string&amp; resource_id,
xml_schema::flags f = 0,
@@ -2296,29 +2300,29 @@ people (std::istream&amp; is,
to pass additional information to the parsing functions. We will
use these two arguments in <a href="#5.1">Section 5.1, "XML Schema
Validation and Searching"</a> below. All three functions return
- the object model as either <code>std::auto_ptr</code> (C++98) or
- <code>std::unique_ptr</code> (C++11), depending on the C++ standard
+ the object model as either <code>std::unique_ptr</code> (C++11) or
+ <code>std::auto_ptr</code> (C++98), depending on the C++ standard
selected (<code>--std</code> XSD compiler option). The following
example shows how we can use the above parsing functions:</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
// Parse a local file or URI.
//
-auto_ptr&lt;people_t> p1 (people ("people.xml"));
-auto_ptr&lt;people_t> p2 (people ("http://example.com/people.xml"));
+unique_ptr&lt;people_t> p1 (people ("people.xml"));
+unique_ptr&lt;people_t> p2 (people ("http://example.com/people.xml"));
// Parse a local file via ifstream.
//
std::ifstream ifs ("people.xml");
-auto_ptr&lt;people_t> p3 (people (ifs, "people.xml"));
+unique_ptr&lt;people_t> p3 (people (ifs, "people.xml"));
// Parse an XML string.
//
std::string str ("..."); // XML in a string.
std::istringstream iss (str);
-auto_ptr&lt;people_t> p4 (people (iss));
+unique_ptr&lt;people_t> p4 (people (iss));
</pre>
@@ -2331,7 +2335,7 @@ auto_ptr&lt;people_t> p4 (people (iss));
flag to the parsing functions, for example:</p>
<pre class="c++">
-auto_ptr&lt;people_t> p (
+unique_ptr&lt;people_t> p (
people ("people.xml", xml_schema::flags::dont_validate));
</pre>
@@ -2373,7 +2377,7 @@ xml_schema::properties props;
props.no_namespace_schema_location ("people.xsd");
props.schema_location ("http://www.w3.org/XML/1998/namespace", "xml.xsd");
-auto_ptr&lt;people_t> p (people ("people.xml", 0, props));
+unique_ptr&lt;people_t> p (people ("people.xml", 0, props));
</pre>
<p>The schema locations provided with this method overrides
@@ -2405,7 +2409,7 @@ props.schema_location (
"http://www.w3.org/XML/1998/namespace",
"file:///" + std::string (cwd) + "/xml.xsd");
-auto_ptr&lt;people_t> p (people ("people.xml", 0, props));
+unique_ptr&lt;people_t> p (people ("people.xml", 0, props));
</pre>
<p>A third method is the most useful if you are planning to parse
@@ -2414,14 +2418,16 @@ auto_ptr&lt;people_t> p (people ("people.xml", 0, props));
the XML parser which can then be used to parse all documents
without re-parsing the schemas. For more information on
this method refer to the <code>caching</code> example in the
- <code>examples/cxx/tree/</code> directory of the XSD
- distribution. It is also possible to convert the schemas into
- a pre-compiled binary representation and embed this representation
- directly into the application executable. With this approach your
- application can perform XML Schema validation without depending on
- any external schema files. For more information on how to achieve
- this refer to the <code>embedded</code> example in the
- <code>examples/cxx/tree/</code> directory of the XSD distribution.</p>
+ <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package.
+ It is also possible to convert the schemas into a pre-compiled
+ binary representation and embed this representation directly into
+ the application executable. With this approach your application can
+ perform XML Schema validation without depending on any external
+ schema files. For more information on how to achieve this refer to
+ the <code>embedded</code> example in the <code>cxx/tree/</code>
+ directory in the <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<p>When the XML parser cannot locate a schema for the
XML document, the validation fails and XML document
@@ -2457,7 +2463,7 @@ people.xml:9:10 error: no declaration found for element 'age'
<pre class="c++">
try
{
- auto_ptr&lt;people_t> p (people ("people.xml"));
+ unique_ptr&lt;people_t> p (people ("people.xml"));
}
catch (const xml_schema::exception&amp; e)
{
@@ -2492,7 +2498,7 @@ if (ifs.fail ())
return 1;
}
-auto_ptr&lt;people_t> p (people (ifs, "people.xml"));
+unique_ptr&lt;people_t> p (people (ifs, "people.xml"));
if (ifs.fail ())
{
@@ -2511,7 +2517,7 @@ try
ifs.exceptions (std::ifstream::badbit | std::ifstream::failbit);
ifs.open ("people.xml");
- auto_ptr&lt;people_t> p (people (ifs, "people.xml"));
+ unique_ptr&lt;people_t> p (people (ifs, "people.xml"));
}
catch (const std::ifstream::failure&amp;)
{
diff --git a/xsd/doc/cxx/tree/manual/index.xhtml.in b/xsd/doc/cxx/tree/manual/index.xhtml.in
index 48f36b6..5a7240a 100644
--- a/xsd/doc/cxx/tree/manual/index.xhtml.in
+++ b/xsd/doc/cxx/tree/manual/index.xhtml.in
@@ -469,12 +469,14 @@
<li><a href="https://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml">XSD
Compiler Command Line Manual</a></li>
- <li>The <code>examples/cxx/tree/</code> directory in the XSD
- distribution contains a collection of examples and a README
- file with an overview of each example.</li>
+ <li>The <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ contains a collection of examples and a README file with an overview
+ of each example.</li>
- <li>The <code>README</code> file in the XSD distribution explains
- how to compile the examples on various platforms.</li>
+ <li>The <code>README</code> file in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a> package
+ explains how to build the examples.</li>
<li>The <a href="https://www.codesynthesis.com/mailman/listinfo/xsd-users">xsd-users</a>
mailing list is a place to ask questions. Furthermore the
@@ -522,12 +524,12 @@
<h3><a name="2.1.1">2.1.1 C++ Standard</a></h3>
- <p>The C++/Tree mapping provides support for ISO/IEC C++ 1998/2003 (C++98)
- and ISO/IEC C++ 2011 (C++11). To select the C++ standard for the
+ <p>The C++/Tree mapping provides support for ISO/IEC C++ 2011 (C++11)
+ and ISO/IEC C++ 1998/2003 (C++98). To select the C++ standard for the
generated code we use the <code>--std</code> XSD compiler command
- line option. While the majority of the examples in this manual use
- C++98, support for the new functionality and library components
- introduced in C++11 are discussed throughout the document.</p>
+ line option. While the majority of the examples in this guide use
+ C++11, the document explains the C++11/98 usage difference and so
+ they can easily be converted to C++98.</p>
<h3><a name="2.1.2">2.1.2 Identifiers</a></h3>
@@ -1144,8 +1146,8 @@ namespace system
sequences of non-fundamental C++ types is the addition of
the overloaded <code>push_back</code> and <code>insert</code>
member functions which instead of the constant reference
- to the element type accept automatic pointer (<code>std::auto_ptr</code>
- or <code>std::unique_ptr</code>, depending on the C++ standard
+ to the element type accept automatic pointer (<code>std::unique_ptr</code>
+ or <code>std::auto_ptr</code>, depending on the C++ standard
selected) to the element type. These functions assume ownership
of the pointed to object and reset the passed automatic pointer.
</p>
@@ -2412,8 +2414,8 @@ public:
sequences of non-fundamental C++ types is the addition of
the overloaded <code>push_back</code> and <code>insert</code>
member functions which instead of the constant reference
- to the element type accept automatic pointer (<code>std::auto_ptr</code>
- or <code>std::unique_ptr</code>, depending on the C++ standard
+ to the element type accept automatic pointer (<code>std::unique_ptr</code>
+ or <code>std::auto_ptr</code>, depending on the C++ standard
selected) to the element type. These functions assume ownership
of the pointed to object and reset the passed automatic pointer.
</p>
@@ -2480,10 +2482,10 @@ public:
instance is initialized with copies of the passed objects. In the
second constructor, arguments that are complex types (that is,
they themselves contain elements or attributes) are passed as
- either <code>std::auto_ptr</code> (C++98) or <code>std::unique_ptr</code>
- (C++11), depending on the C++ standard selected. In this case the newly
+ either <code>std::unique_ptr</code> (C++11) or <code>std::auto_ptr</code>
+ (C++98), depending on the C++ standard selected. In this case the newly
created instance is directly initialized with and assumes ownership
- of the pointed to objects and the <code>std::[auto|unique]_ptr</code>
+ of the pointed to objects and the <code>std::[unique|auto]_ptr</code>
arguments are reset to <code>0</code>. For instance:</p>
<pre class="xml">
@@ -2529,7 +2531,7 @@ class object: public xml_schema::type
{
public:
object (const bool&amp; s_one, const complex&amp; c_one);
- object (const bool&amp; s_one, std::[auto|unique]_ptr&lt;complex> c_one);
+ object (const bool&amp; s_one, std::[unique|auto]_ptr&lt;complex> c_one);
object (const object&amp;);
public:
@@ -2546,7 +2548,7 @@ public:
</pre>
<p>Notice that the generated <code>complex</code> class does not
- have the second (<code>std::[auto|unique]_ptr</code>) version of the
+ have the second (<code>std::[unique|auto]_ptr</code>) version of the
constructor since all its required members are of simple types.</p>
<p>If an XML Schema complex type has an ultimate base which is an XML
@@ -2817,8 +2819,8 @@ public:
constant of the member's type. It makes a deep copy of its argument.
Except for member's types that are mapped to fundamental C++ types,
the second modifier function is provided that expects an argument
- of type automatic pointer (<code>std::auto_ptr</code> or
- <code>std::unique_ptr</code>, depending on the C++ standard selected)
+ of type automatic pointer (<code>std::unique_ptr</code> or
+ <code>std::auto_ptr</code>, depending on the C++ standard selected)
to the member's type. It assumes ownership of the pointed to object
and resets the passed automatic pointer. For instance:</p>
@@ -2854,7 +2856,7 @@ public:
member (const member_type&amp;);
void
- member (std::[auto|unique]_ptr&lt;member_type>);
+ member (std::[unique|auto]_ptr&lt;member_type>);
...
};
@@ -2871,7 +2873,7 @@ class object: public xml_schema::type
public:
...
- std::[auto|unique]_ptr&lt;member_type>
+ std::[unique|auto]_ptr&lt;member_type>
detach_member ();
...
@@ -2896,19 +2898,19 @@ f (object&amp; o)
o.member ("hello"); // set, deep copy
o.member () = "hello"; // set, deep copy
- // C++98 version.
- //
- std::auto_ptr&lt;string> p (new string ("hello"));
- o.member (p); // set, assumes ownership
- p = o.detach_member (); // detach, member is uninitialized
- o.member (p); // re-attach
-
// C++11 version.
//
std::unique_ptr&lt;string> p (new string ("hello"));
o.member (std::move (p)); // set, assumes ownership
p = o.detach_member (); // detach, member is uninitialized
o.member (std::move (p)); // re-attach
+
+ // C++98 version.
+ //
+ std::auto_ptr&lt;string> p (new string ("hello"));
+ o.member (p); // set, assumes ownership
+ p = o.detach_member (); // detach, member is uninitialized
+ o.member (p); // re-attach
}
</pre>
@@ -2938,8 +2940,8 @@ f (object&amp; o)
member's type. It makes a deep copy of its argument.
Except for member's types that are mapped to fundamental C++ types,
the second modifier function is provided that expects an argument
- of type automatic pointer (<code>std::auto_ptr</code> or
- <code>std::unique_ptr</code>, depending on the C++ standard selected)
+ of type automatic pointer (<code>std::unique_ptr</code> or
+ <code>std::auto_ptr</code>, depending on the C++ standard selected)
to the member's type. It assumes ownership of the pointed to object
and resets the passed automatic pointer. The last modifier function
expects an argument of type reference to constant of the container
@@ -2979,7 +2981,7 @@ public:
member (const member_type&amp;);
void
- member (std::[auto|unique]_ptr&lt;member_type>);
+ member (std::[unique|auto]_ptr&lt;member_type>);
void
member (const member_optional&amp;);
@@ -2992,7 +2994,7 @@ public:
<p>The <code>optional</code> class template is defined in an
implementation-specific namespace and has the following
- interface. The <code>[auto|unique]_ptr</code>-based constructor
+ interface. The <code>[unique|auto]_ptr</code>-based constructor
and modifier function are only available if the template
argument is not a fundamental C++ type.
</p>
@@ -3012,7 +3014,7 @@ public:
// Assumes ownership.
//
explicit
- optional (std::[auto|unique]_ptr&lt;X>);
+ optional (std::[unique|auto]_ptr&lt;X>);
optional (const optional&amp;);
@@ -3061,11 +3063,11 @@ public:
// Assumes ownership.
//
void
- set (std::[auto|unique]_ptr&lt;X>);
+ set (std::[unique|auto]_ptr&lt;X>);
// Detach and return the contained value.
//
- std::[auto|unique]_ptr&lt;X>
+ std::[unique|auto]_ptr&lt;X>
detach ();
void
@@ -3124,17 +3126,6 @@ f (object&amp; o)
o.member ().reset (); // reset
}
- // C++98 version.
- //
- std::auto_ptr&lt;string> p (new string ("hello"));
- o.member (p); // set, assumes ownership
-
- p = new string ("hello");
- o.member ().set (p); // set, assumes ownership
-
- p = o.member ().detach (); // detach, member is reset
- o.member ().set (p); // re-attach
-
// C++11 version.
//
std::unique_ptr&lt;string> p (new string ("hello"));
@@ -3145,6 +3136,17 @@ f (object&amp; o)
p = o.member ().detach (); // detach, member is reset
o.member ().set (std::move (p)); // re-attach
+
+ // C++98 version.
+ //
+ std::auto_ptr&lt;string> p (new string ("hello"));
+ o.member (p); // set, assumes ownership
+
+ p = new string ("hello");
+ o.member ().set (p); // set, assumes ownership
+
+ p = o.member ().detach (); // detach, member is reset
+ o.member ().set (p); // re-attach
}
</pre>
@@ -3226,7 +3228,7 @@ public:
as well as the <code>detach_back</code> and <code>detach</code>
member functions. The additional <code>push_back</code> and
<code>insert</code> functions accept an automatic pointer
- (<code>std::auto_ptr</code> or <code>std::unique_ptr</code>,
+ (<code>std::unique_ptr</code> or <code>std::auto_ptr</code>,
depending on the C++ standard selected) to the
element type instead of the constant reference. They assume
ownership of the pointed to object and reset the passed
@@ -3244,17 +3246,17 @@ public:
...
void
- push_back (std::[auto|unique]_ptr&lt;X>)
+ push_back (std::[unique|auto]_ptr&lt;X>)
iterator
- insert (iterator position, std::[auto|unique]_ptr&lt;X>)
+ insert (iterator position, std::[unique|auto]_ptr&lt;X>)
- std::[auto|unique]_ptr&lt;X>
+ std::[unique|auto]_ptr&lt;X>
detach_back (bool pop = true);
iterator
detach (iterator position,
- std::[auto|unique]_ptr&lt;X>&amp; result,
+ std::[unique|auto]_ptr&lt;X>&amp; result,
bool erase = true)
...
@@ -3282,13 +3284,6 @@ f (object&amp; o)
//
s.push_back ("hello"); // deep copy
- // C++98 version.
- //
- std::auto_ptr&lt;string> p (new string ("hello"));
- s.push_back (p); // assumes ownership
- p = s.detach_back (); // detach and pop
- s.push_back (p); // re-append
-
// C++11 version.
//
std::unique_ptr&lt;string> p (new string ("hello"));
@@ -3296,6 +3291,13 @@ f (object&amp; o)
p = s.detach_back (); // detach and pop
s.push_back (std::move (p)); // re-append
+ // C++98 version.
+ //
+ std::auto_ptr&lt;string> p (new string ("hello"));
+ s.push_back (p); // assumes ownership
+ p = s.detach_back (); // detach and pop
+ s.push_back (p); // re-append
+
// Setting a new container.
//
object::member_sequence n;
@@ -3617,7 +3619,9 @@ w[0].amount (10000);
<p>For the complete working code shown in this section refer to the
<code>order/element</code> example in the
- <code>examples/cxx/tree/</code> directory in the XSD distribution.</p>
+ <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<p>If both the base and derived types are ordered, then the
content order sequence is only added to the base and the content
@@ -3646,8 +3650,7 @@ w[0].amount (10000);
<p>As an example, here is how we can use the Boost Multi-Index
container for content order. First we create the
<code>content-order-container.hxx</code> header with the
- following definition (in C++11, use the alias template
- instead):</p>
+ following definition:</p>
<pre class="c++">
#ifndef CONTENT_ORDER_CONTAINER
@@ -3665,7 +3668,7 @@ struct by_id {};
struct by_id_index {};
template &lt;typename T>
-struct content_order_container:
+using content_order_container =
boost::multi_index::multi_index_container&lt;
T,
boost::multi_index::indexed_by&lt;
@@ -3679,8 +3682,7 @@ struct content_order_container:
boost::multi_index::member&lt;T, std::size_t, &amp;T::id>
>
>
- >
-{};
+ >;
#endif
</pre>
@@ -3734,7 +3736,7 @@ for (id_iterator i (r.first); i != r.second; ++i)
<p>The parsing functions read XML instance documents and return
corresponding object models as an automatic pointer
- (<code>std::auto_ptr</code> or <code>std::unique_ptr</code>,
+ (<code>std::unique_ptr</code> or <code>std::auto_ptr</code>,
depending on the C++ standard selected). Their signatures
have the following pattern (<code>type</code> denotes
element's type and <code>name</code> denotes element's
@@ -3742,7 +3744,7 @@ for (id_iterator i (r.first); i != r.second; ++i)
</p>
<pre class="c++">
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (....);
</pre>
@@ -3814,13 +3816,13 @@ public:
value (const value_type&amp;);
void
- value (std::[auto|unique]_ptr&lt;value_type>);
+ value (std::[unique|auto]_ptr&lt;value_type>);
// Constructors.
//
root (const value_type&amp;);
- root (std::[auto|unique]_ptr&lt;value_type>);
+ root (std::[unique|auto]_ptr&lt;value_type>);
root (const xercesc::DOMElement&amp;, xml_schema::flags = 0);
@@ -3916,7 +3918,7 @@ namespace xml_schema
class element_map
{
public:
- static std::[auto|unique]_ptr&lt;xml_schema::element_type>
+ static std::[unique|auto]_ptr&lt;xml_schema::element_type>
parse (const xercesc::DOMElement&amp;, flags = 0);
static void
@@ -3927,8 +3929,8 @@ namespace xml_schema
<p>The <code>parse()</code> function creates the corresponding
element type object based on the element name and namespace
- and returns it as an automatic pointer (<code>std::auto_ptr</code>
- or <code>std::unique_ptr</code>, depending on the C++ standard
+ and returns it as an automatic pointer (<code>std::unique_ptr</code>
+ or <code>std::auto_ptr</code>, depending on the C++ standard
selected) to <code>xml_schema::element_type</code>.
The <code>serialize()</code> function serializes the passed element
object to <code>DOMElement</code>. Note that in case of
@@ -3965,7 +3967,7 @@ struct no_element_info: virtual exception
//
DOMElement&amp; e = ... // Parse XML to DOM.
-auto_ptr&lt;xml_schema::element_type> r (
+unique_ptr&lt;xml_schema::element_type> r (
xml_schema::element_map::parse (e));
if (root1 r1 = dynamic_cast&lt;root1*> (r.get ()))
@@ -4097,7 +4099,7 @@ f (root&amp; r)
i != r.item ().end ()
++i)
{
- std::auto_ptr&lt;base> c (i->_clone ());
+ std::unique_ptr&lt;base> c (i->_clone ());
}
}
</pre>
@@ -4881,8 +4883,9 @@ for (batch::content_order_const_iterator i (b.content_order ().begin ());
<p>For the complete working code that shows the use of wildcards in
ordered types refer to the <code>order/element</code> example in
- the <code>examples/cxx/tree/</code> directory in the XSD
- distribution.</p>
+ the <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<h3><a name="2.12.5">2.12.5 Mapping for <code>anyAttribute</code></a></h3>
@@ -5293,8 +5296,9 @@ for (text::content_order_const_iterator i (t.content_order ().begin ());
<p>For the complete working code that shows the use of mixed content
in ordered types refer to the <code>order/mixed</code> example in
- the <code>examples/cxx/tree/</code> directory in the XSD
- distribution.</p>
+ the <code>cxx/tree/</code> directory in the
+ <a href="https://cppget.org/xsd-examples">xsd-examples</a>
+ package.</p>
<!-- Parsing -->
@@ -5318,18 +5322,18 @@ for (text::content_order_const_iterator i (t.content_order ().begin ());
// Read from a URI or a local file.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const std::basic_string&lt;C>&amp; uri,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const std::basic_string&lt;C>&amp; uri,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const std::basic_string&lt;C>&amp; uri,
xercesc::DOMErrorHandler&amp;,
xml_schema::flags = 0,
@@ -5339,38 +5343,38 @@ name (const std::basic_string&lt;C>&amp; uri,
// Read from std::istream.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
xercesc::DOMErrorHandler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
const std::basic_string&lt;C>&amp; id,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
const std::basic_string&lt;C>&amp; id,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (std::istream&amp;,
const std::basic_string&lt;C>&amp; id,
xercesc::DOMErrorHandler&amp;,
@@ -5381,18 +5385,18 @@ name (std::istream&amp;,
// Read from InputSource.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (xercesc::InputSource&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (xercesc::InputSource&amp;,
xml_schema::error_handler&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (xercesc::InputSource&amp;,
xercesc::DOMErrorHandler&amp;,
xml_schema::flags = 0,
@@ -5402,13 +5406,13 @@ name (xercesc::InputSource&amp;,
// Read from DOM.
//
-std::[auto|unique]_ptr&lt;type>
+std::[unique|auto]_ptr&lt;type>
name (const xercesc::DOMDocument&amp;,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
-std::[auto|unique]_ptr&lt;type>
-name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
+std::[unique|auto]_ptr&lt;type>
+name (xml_schema::dom::[unique|auto]_ptr&lt;xercesc::DOMDocument>,
xml_schema::flags = 0,
const xml_schema::properties&amp; = xml_schema::properties ());
</pre>
@@ -5418,7 +5422,7 @@ name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
or a pre-parsed DOM instance in the form of
<code>xercesc::DOMDocument</code>. All the parsing functions
return a dynamically allocated object model as either
- <code>std::auto_ptr</code> or <code>std::unique_ptr</code>,
+ <code>std::unique_ptr</code> or <code>std::auto_ptr</code>,
depending on the C++ standard selected. Each of these parsing
functions is discussed in more detail in the following sections.
</p>
@@ -5462,7 +5466,7 @@ name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
<dd>Assume ownership of the DOM document passed. This flag only
makes sense together with the <code>keep_dom</code> flag in
the call to the parsing function with the
- <code>xml_schema::dom::[auto|unique]_ptr&lt;DOMDocument></code>
+ <code>xml_schema::dom::[unique|auto]_ptr&lt;DOMDocument></code>
argument.</dd>
<dt><code>xml_schema::flags::dont_validate</code></dt>
@@ -5478,7 +5482,7 @@ name (xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>,
<pre class="c++">
using xml_schema::flags;
-std::auto_ptr&lt;type> r (
+std::unique_ptr&lt;type> r (
name ("test.xml", flags::keep_dom | flags::dont_validate));
</pre>
@@ -5912,19 +5916,19 @@ struct no_prefix_mapping: virtual exception
For example:</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
-auto_ptr&lt;type> r1 (name ("test.xml"));
-auto_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
+unique_ptr&lt;type> r1 (name ("test.xml"));
+unique_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
</pre>
- <p>Or, in the C++11 mode:</p>
+ <p>Or, in the C++98 mode:</p>
<pre class="c++">
-using std::unique_ptr;
+using std::auto_ptr;
-unique_ptr&lt;type> r1 (name ("test.xml"));
-unique_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
+auto_ptr&lt;type> r1 (name ("test.xml"));
+auto_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
</pre>
<h2><a name="3.5">3.5 Reading from <code>std::istream</code></a></h2>
@@ -5935,17 +5939,17 @@ unique_ptr&lt;type> r2 (name ("https://www.codesynthesis.com/test.xml"));
relative paths. For instance:</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
{
std::ifstream ifs ("test.xml");
- auto_ptr&lt;type> r (name (ifs, "test.xml"));
+ unique_ptr&lt;type> r (name (ifs, "test.xml"));
}
{
std::string str ("..."); // Some XML fragment.
std::istringstream iss (str);
- auto_ptr&lt;type> r (name (iss));
+ unique_ptr&lt;type> r (name (iss));
}
</pre>
@@ -5958,7 +5962,7 @@ using std::auto_ptr;
<pre class="c++">
xercesc::StdInInputSource is;
-std::auto_ptr&lt;type> r (name (is));
+std::unique_ptr&lt;type> r (name (is));
</pre>
<h2><a name="3.7">3.7 Reading from DOM</a></h2>
@@ -5981,15 +5985,6 @@ std::auto_ptr&lt;type> r (name (is));
of the DOM document passed. For example:</p>
<pre class="c++">
-// C++98 version.
-//
-xml_schema::dom::auto_ptr&lt;xercesc::DOMDocument> doc = ...
-
-std::auto_ptr&lt;type> r (
- name (doc, xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
-
-// At this point doc is reset to 0.
-
// C++11 version.
//
xml_schema::dom::unique_ptr&lt;xercesc::DOMDocument> doc = ...
@@ -5999,6 +5994,15 @@ std::unique_ptr&lt;type> r (
xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
// At this point doc is reset to 0.
+
+// C++98 version.
+//
+xml_schema::dom::auto_ptr&lt;xercesc::DOMDocument> doc = ...
+
+std::auto_ptr&lt;type> r (
+ name (doc, xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
+
+// At this point doc is reset to 0.
</pre>
<h1><a name="4">4 Serialization</a></h1>
@@ -6086,7 +6090,7 @@ name (xercesc::XMLFormatTarget&amp;,
// Serialize to DOM.
//
-xml_schema::dom::[auto|unique]_ptr&lt;xercesc::DOMDocument>
+xml_schema::dom::[unique|auto]_ptr&lt;xercesc::DOMDocument>
name (const type&amp;,
const xml_schema::namespace_infomap&amp;
xml_schema::namespace_infomap (),
@@ -6275,7 +6279,7 @@ map[""].schema = "test.xsd";
operator. For example:</p>
<pre class="c++">
-std::auto_ptr&lt;type> r = ...
+std::unique_ptr&lt;type> r = ...
std::ofstream ofs ("test.xml");
xml_schema::namespace_infomap map;
name (ofs,
@@ -6384,7 +6388,7 @@ struct serialization: virtual exception
<pre class="c++">
// Obtain the object model.
//
-std::auto_ptr&lt;type> r = ...
+std::unique_ptr&lt;type> r = ...
// Prepare namespace mapping and schema location information.
//
@@ -6417,11 +6421,11 @@ name (std::cout, *r, map);
</p>
<pre class="c++">
-using std::auto_ptr;
+using std::unique_ptr;
// Obtain the object model.
//
-auto_ptr&lt;type> r = ...
+unique_ptr&lt;type> r = ...
// Prepare namespace mapping and schema location information.
//
@@ -6437,15 +6441,15 @@ XMLPlatformUtils::Initialize ();
{
// Choose a target.
//
- auto_ptr&lt;XMLFormatTarget> ft;
+ unique_ptr&lt;XMLFormatTarget> ft;
if (argc != 2)
{
- ft = auto_ptr&lt;XMLFormatTarget> (new StdOutFormatTarget ());
+ ft = unique_ptr&lt;XMLFormatTarget> (new StdOutFormatTarget ());
}
else
{
- ft = auto_ptr&lt;XMLFormatTarget> (
+ ft = unique_ptr&lt;XMLFormatTarget> (
new LocalFileFormatTarget (argv[1]));
}
@@ -6477,7 +6481,7 @@ XMLPlatformUtils::Terminate ();
<pre class="c++">
// Obtain the object model.
//
-std::auto_ptr&lt;type> r = ...
+std::unique_ptr&lt;type> r = ...
using namespace xercesc;
@@ -6565,7 +6569,7 @@ XMLPlatformUtils::Initialize ();
{
// Parse XML to object model.
//
- std::auto_ptr&lt;type> r (root (
+ std::unique_ptr&lt;type> r (root (
"root.xml",
xml_schema::flags::keep_dom |
xml_schema::flags::dont_initialize));
@@ -6612,7 +6616,7 @@ XMLPlatformUtils::Initialize ();
{
// Parse XML to object model.
//
- std::auto_ptr&lt;type> r (root (
+ std::unique_ptr&lt;type> r (root (
"root.xml",
xml_schema::flags::keep_dom |
xml_schema::flags::dont_initialize));
@@ -6703,7 +6707,7 @@ XMLPlatformUtils::Terminate ();
<pre class="c++">
// Parse XML to object model.
//
-std::auto_ptr&lt;type> r (root ("root.xml"));
+std::unique_ptr&lt;type> r (root ("root.xml"));
// Save to a CDR stream.
//
@@ -6717,7 +6721,7 @@ ocdr &lt;&lt; *r;
ACE_InputCDR ace_icdr (buf, size);
xml_schema::istream&lt;ACE_InputCDR> icdr (ace_icdr);
-std::auto_ptr&lt;object> copy (new object (icdr));
+std::unique_ptr&lt;object> copy (new object (icdr));
// Serialize to XML.
//