根据xbinder documentation,在xbinder命令行上传递-genreader
和-genwriter
将生成例如reader.cpp和writer.cpp。但它不适合我。我做错了吗?
$ ls -l
total 4
-rw-rw-r--. 1 hrubin hrubin 444 Jul 6 09:59 cdl.xsd
$ cat cdl.xsd
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xsd:complexType name="cdl">
<xsd:sequence>
<xsd:element name="Polygon" type="xsd:string" />
<xsd:element name="Table" type="xsd:integer" />
<xsd:element name="Shape" type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
$ ~/Downloads/xbv240/bin/xbinder cdl.xsd -c++ -xml -genmake -genwriter
XBinder Compiler, Version 2.4.0 DEVELOPMENT VERSION
Copyright (c) 2002-2016 Objective Systems, Inc. All Rights Reserved.
Parsing XML schema definitions..
Compiling XML schema file ./cdl.xsd..
Writing C++ type and class definitions to file cdl.h..
Writing C++ encode functions to file cdlEnc.cpp..
Writing C++ decode functions to file cdlDec.cpp..
Writing C++ common functions to file cdl.cpp..
Generating makefile..
Compilation was successful.
$ ls -l
total 28
-rw-rw-r--. 1 hrubin hrubin 878 Jul 6 11:13 cdl.cpp
-rw-rw-r--. 1 hrubin hrubin 2265 Jul 6 11:13 cdlDec.cpp
-rw-rw-r--. 1 hrubin hrubin 1402 Jul 6 11:13 cdlEnc.cpp
-rw-rw-r--. 1 hrubin hrubin 1336 Jul 6 11:13 cdl.h
-rw-rw-r--. 1 hrubin hrubin 444 Jul 6 09:59 cdl.xsd
-rw-rw-r--. 1 hrubin hrubin 1220 Jul 6 11:13 makefile
-rw-rw-r--. 1 hrubin hrubin 818 Jul 6 11:13 rtkey.h
$
答案 0 :(得分:0)
显然,你必须有一个顶级元素来生成阅读器或编写器示例程序。技术支持建议将此行添加到模式文件中,该文件有效。
<xsd:element name="CDL_ELEMENT" type="cdl"/>