XSD 方案语法和 gSoap
XSD scheme syntax and gSoap
我有一个问题,这个XSD语法有效吗?因为当我使用 gSOAP 时,它会向我发出警告,因为它创建了结构(C/C++ 代码(,它由另外两个具有相同名称的结构(名称 C(组成,然后当我尝试在 c/c++ 编译器中编译该代码时,它会产生错误(因为一个结构内具有相同名称的结构(。这里有如何在不接触 XSD 文件的情况下解决此问题的可能性吗?
<complexType name="A">
<choice>
<sequence>
<element name="B" type="base64Binary"/>
<element name="C" type="base64Binary" minOccurs="0"/>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<sequence>
<element name="C" type="base64Binary"/>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</choice>
</complexType>
在 gSOAP 中,我使用以下方法创建它:wsdl2h.exe -oSoap.h -s -y -c a.wsdl b.wsdl ...
和
soapcpp2.exe -C -L -n -x -w -c -d.source Soap.h
是的,它是有效的 XSD 语法;它看起来像您的代码生成器无法处理的情况。
soapcpp2 工具只抱怨,但生成的代码按设计工作。我对此进行了研究并对其进行了测试。
这是我由soapcpp2生成的:
class ns__A
{ public:
// BEGIN CHOICE <xs:choice>
/// @note <xs:choice> with embedded <xs:sequence> or <xs:group> prevents the use of a union for <xs:choice>. Instead of being members of a union, the following members are declared optional. Only one member should be non-NULL by choice.
// BEGIN SEQUENCE <xs:sequence>
/// Element "B" of XSD type xs:base64Binary.
xsd__base64Binary* B nullptr; ///< Required nillable (xsi:nil when NULL) element.
/// Element "C" of XSD type xs:base64Binary.
xsd__base64Binary* C ; ///< Required element.
/// Size of the array of XML or DOM nodes is 0..unbounded.
std::vector<_XML > __any 0; ///< Catch any element content in XML string.
// END OF SEQUENCE
// BEGIN SEQUENCE <xs:sequence>
/// Element "C" of XSD type xs:base64Binary.
xsd__base64Binary* C nullptr; ///< Required nillable (xsi:nil when NULL) element.
/// Size of the array of XML or DOM nodes is 0..unbounded.
std::vector<_XML > __any 0; ///< Catch any element content in XML string.
// END OF SEQUENCE
// END OF CHOICE
/// A handle to the soap struct context that manages this instance when instantiated by a context or NULL otherwise (automatically set).
struct soap *soap ;
};
soapcpp2 报告的"问题"的原因是流式序列化程序无法区分C
的选择。所以两者都是编码的。第二个C
重命名为 C_
,并且从不用于反序列化数据。
简单的解释:你很好。
相关文章:
- 1d 智能指针不适用于语法 (*)++
- 助记符和指向成员语法的指针
- 有人能分解一下这个c++模板的语法吗
- C++避免重复声明的语法是什么
- QMetaObject invokeMethod的基于函数指针的语法
- 这个语法std::class<>{}(arg1, arg2) 在C++中是什么意思?
- 为什么包含windows.h会产生语法错误,从而阻止类的实例化?(C2146,C2065)
- 使用GSoap实现ONVIF
- 使用 mod_gsoap 部署服务时,如何在 Gsoap 中更改 soap 上下文的模式?
- 单独定义模板化嵌套类方法的正确语法
- 共享指针和具有自定义删除程序的唯一指针之间的语法差异背后的任何原因
- 错误 C2760:语法错误:映射迭代器上意外的标记"标识符",预期的";"
- gSoap在从.wsdl创建.h期间出现错误
- 为什么我会收到错误 C2143 语法错误:缺少"*"之前的';'?
- 奇怪的代码抛出编译错误模板< J,int aSize=10> C2143:语法错误:在"<"之前缺少";"
- 使用基类指针调用基类的值构造函数的语法是什么?
- 很好的语法来获取对向量/数组数据的大小引用?
- C++语法运算符功能?
- XSD 方案语法和 gSoap
- 语法错误:需要声明.为什么gsoap不能读取vector