c++qtxsdxsd.execodesynthesis

How to include CodeSynthesis-XSD into own application?


1.) How can i include the CodeSynthesis-XSD Code-generation into my application, so when i give the application (QT in Visual Studio 10) to someone other he doesnt need to install Code-Synthesis?


2.) And how can i specify the output-directory of the .cpp and .h files? xsd help doesnt list such an option? i generate like this with the tree:

>xsd cxx-tree "C:\scheme.xsd"

-> solved via a "cd" (Change-Directory) before executing xsd


3.) i get warnings that i dont know how to solve:

warning F002: attribute 'value' is implicitly of anySimpleType
info: did you forget to specify 'type' attribute?
warning T004: generating parsing functions for 18 global elements
info: use --root-element-* options to specify document root(s)

are there additional parameters that arent listed in xsd help?


Solution

    1. The runtime library (libxsd) is header-only so there is no need for the end user to install it if you are providing your software in compiled form.

    2. Use the --output-dir option

        erik@ubuntu:~$ xsdcxx help cxx-tree 2>&1 | grep -A1 output-dir
          --output-dir <dir>          Write generated files to <dir> instead of current
                                      directory.
    

    3. Regarding "warning T004":

        erik@ubuntu:~$ xsdcxx help cxx-tree 2>&1 | grep -A1 root-element
          --root-element-first        Treat only the first global element as a document
                                      root.
          --root-element-last         Treat only the last global element as a document
                                      root.
          --root-element-all          Treat all global elements as document roots.
          --root-element-none         Don't treat any global elements as document roots.
          --root-element <element>    Treat only <element> as a document root. Repeat
                                      this option to specify more than one root element.
    

    If you don't specify any of these options, --root-element-all is implied but you will see the "warning T004". If --root-element-all is what you want, I suggest adding that option to make the warning go away.

    Regarding "warning F002": Sorry, I don't know.

    Note: "2>&1" will not be needed in the future when CodeSynthesis XSD will start printing the help text to stdout. http://codesynthesis.com/pipermail/xsd-users/2012-March/003577.html