如何将CodeSynthesis XSD包含到自己的应用程序中

How to include CodeSynthesis-XSD into own application?

本文关键字:自己的 应用程序 包含 XSD CodeSynthesis      更新时间:2023-10-16

1.(我如何将CodeSynthesis XSD代码生成包含到我的应用程序中,这样当我将应用程序(Visual Studio 10中的QT(交给其他人时,他就不需要安装CodeSynthesis?


2.(如何指定.cpp.h文件的输出目录?xsd help没有列出这样的选项?我用树生成如下:

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

->在执行xsd之前通过"cd"(更改目录(解决


3.(我收到了不知道如何解决的警告:

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)

是否有未在xsd help中列出的其他参数?

  1. 运行时库(libxsd(只是头,所以如果您以编译的形式提供软件,那么最终用户就不需要安装它

  2. 使用--output-dir选项

    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.关于"警告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.

如果您没有指定这些选项中的任何一个,则暗示--root-element-all,但您将看到"警告T004"。如果--root-element-all是您想要的,我建议添加该选项以使警告消失。

关于"警告F002":对不起,我不知道。

注意:将来CodeSynthesis XSD将开始将帮助文本打印到stdout时,将不需要"2>&1"。http://codesynthesis.com/pipermail/xsd-users/2012-March/003577.html

关于"警告F002",我们遇到了类似的问题,并发现在未指定具体类型的情况下声明属性时会引发该问题。