XSD验证错误:XS的使用:任何XS:元素
问题描述:
在我的XML架构我有如下定义:XSD验证错误:XS的使用:任何XS:元素
<xs:element name="otherResultData">
<xs:any processContents="lax" minOccurs="0" />
</xs:element>
这将给验证错误:
The content of 'otherResultData' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: any.
是否有办法将其定义为:“这里可以有任何内容,但是如果可以在此XSD中找到这些类型,那么它们是有效的”?
答
你需要像
<xs:element name="otherResultData">
<xs:complexType>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:complexType>
</xs:element>