From f0e0fb5f3f2af8b695680e84572137660ffd835b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 16 Feb 2021 21:27:12 +0300 Subject: Update documentation --- xsd/doc/cxx/parser/guide/index.xhtml.in | 68 ++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'xsd/doc/cxx/parser/guide/index.xhtml.in') 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 @@
  • XSD Compiler Command Line Manual
  • -
  • The examples/cxx/parser/ directory in the XSD - distribution contains a collection of examples and a README - file with an overview of each example.
  • +
  • The cxx/parser/ directory in the + xsd-examples package + contains a collection of examples and a README file with an overview + of each example.
  • -
  • The README file in the XSD distribution explains - how to compile the examples on various platforms.
  • +
  • The README file in the + xsd-examples package + explains how to build the examples.
  • The xsd-users mailing list is the place to ask technical questions about XSD and the C++/Parser mapping. @@ -481,8 +483,9 @@

    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 hello - example which can be found in the examples/cxx/parser/ - directory of the XSD distribution.

    + example which can be found in the cxx/parser/ directory in + the xsd-examples + package.

    2.1 Writing XML Document and Schema

    @@ -550,7 +553,7 @@

    -$ xsd cxx-parser --xml-parser expat hello.xsd
    +$ xsd cxx-parser --std c++11 --xml-parser expat hello.xsd
       

    The --xml-parser option indicates that we want to @@ -754,8 +757,8 @@ main (int argc, char* argv[]) on these options refer to the XSD Compiler Command Line Manual. The 'generated' example - in the XSD distribution shows the sample implementation generation - feature in action.

    + in the xsd-examples package + shows the sample implementation generation feature in action.

    2.4 Compiling and Running

    @@ -767,8 +770,8 @@ main (int argc, char* argv[])

    -$ 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!
       

    Here .../libxsd represents the path to the - libxsd directory in the XSD distribution. - We can also test the error handling. To test XML well-formedness - checking, we can try to parse hello-pskel.hxx:

    + libxsd package root + directory. We can also test the error handling. To test XML + well-formedness checking, we can try to parse + hello-pskel.hxx:

     $ ./driver hello-pskel.hxx
    @@ -1490,7 +1494,7 @@ gender ::gender ::gender;
          option to let the XSD compiler know about our type map:

    -$ xsd cxx-parser --type-map people.map people.xsd
    +$ xsd cxx-parser --std c++11 --type-map people.map people.xsd
       

    If we now look at the generated people-pskel.hxx, @@ -1618,9 +1622,9 @@ namespace http://www.example.com/xmlns/my std::wstring depending on the character type selected (see Section 5.2, "Character Type and Encoding" for more information). The binary XML Schema - types are mapped to either std::auto_ptr<xml_schema::buffer> - or std::unique_ptr<xml_schema::buffer> - depending on the C++ standard selected (C++98 or C++11, + types are mapped to either std::unique_ptr<xml_schema::buffer> + or std::auto_ptr<xml_schema::buffer> + depending on the C++ standard selected (C++11 or C++98, respectively; refer to the --std XSD compiler command line option for details).

    @@ -1738,7 +1742,8 @@ people ::people; recompile our schema and move on to implementing the parsers:

    -$ 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
       

    Here is the implementation of our three parsers in full. One @@ -1882,8 +1887,8 @@ main (int argc, char* argv[])

    -$ 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
     
       

    5.1 C++ Standard

    -

    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 +

    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 --std 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.

    + C++11, the document explains the C++11/98 usage difference and so + they can easily be converted to C++98.

    5.2 Character Type and Encoding

    @@ -2354,9 +2359,10 @@ private:

    Most of code presented in this section is taken from the polymorphism example which can be found in the - examples/cxx/parser/ directory of the XSD distribution. - Handling of xsi:type and substitution groups when used - on root elements requires a number of special actions as shown in + cxx/parser/ directory in the + xsd-examples package. + Handling of xsi:type and substitution groups when used on + root elements requires a number of special actions as shown in the polyroot example.

    @@ -2754,8 +2760,8 @@ namespace xml_schema

    The return type of the base64_binary_pimpl and hex_binary_pimpl parser implementations is either - std::auto_ptr<xml_schema::buffer> (C++98) or - std::unique_ptr<xml_schema::buffer> (C++11), + std::unique_ptr<xml_schema::buffer> (C++11) or + std::auto_ptr<xml_schema::buffer> (C++98), depending on the C++ standard selected (--std XSD compiler option). The xml_schema::buffer type represents a binary buffer and its interface is presented below.

    -- cgit v1.1