【发布时间】:2017-02-06 09:08:01
【问题描述】:
我有一个问题,这个 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
【问题讨论】:
-
@KeineLust,gSoap生成C/C++代码,出现一个struct中的两个struct同名的问题。
-
ok ;) 你能显示这些警告吗?
-
error: redefinition of 'struct a::c'和error: previous definition of 'struct a::c' -
@МартинБее 准确地说,这些不仅仅是警告,它们是错误。
-
@user2079303,我同意对不起,我从 gSoap 编译器收到警告,它从带有警告的 xml 创建 c/c++ 代码,然后此代码在 c/c++ 编译器中编译后产生错误。