【发布时间】:2020-10-24 12:25:56
【问题描述】:
我在 Java 应用程序中工作,我需要将 XML 输出显示为一次 GET REST URL 执行的结果。
我收到以下错误:
cvc-complex-type.2.4.a:发现以元素“{”开头的无效内容http://www.example.org/xmlns/sapsaasconnection/SAPAriba/CATALOGCONTENT+facets_GET_Responses+286d4d67-dbb4-4187-ac9e -a9dd069c3035":输出}'。需要“{Output}”之一。
我的 XSD 是:
<schema targetNamespace="http://www.example.org/xmlns/sapsaasconnection/SAPAriba/CATALOGCONTENT+facets_GET_Responses+286d4d67-dbb4-4187-ac9e-a9dd069c3035"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.example.org/xmlns/sapsaasconnection/SAPAriba/CATALOGCONTENT+facets_GET_Responses+286d4d67-dbb4-4187-ac9e-a9dd069c3035"
>
<complexType name="facets_GET_Responses">
<sequence>
<element maxOccurs="1" minOccurs="0" name="Output" type="tns:FacetResponse"/>
</sequence>
</complexType>
<element name="facets_GET_Responses" type="tns:facets_GET_Responses"/>
<complexType name="MapStringToObject">
<all>
<element maxOccurs="1" minOccurs="0" name="count" type="integer"/>
<element maxOccurs="1" minOccurs="0"
name="ClassificationCode" type="string"/>
</all>
</complexType>
<element name="MapStringToObject" type="tns:MapStringToObject"/>
<complexType name="FacetResponse">
<all>
<element maxOccurs="1" minOccurs="0" name="contents" type="tns:contents"/>
<element maxOccurs="1" minOccurs="0" name="offset" type="integer"/>
<element maxOccurs="1" minOccurs="0" name="limit" type="integer"/>
<element maxOccurs="1" minOccurs="0"
name="totalElements" type="integer"/>
<element maxOccurs="1" minOccurs="0"
name="totalPages" type="integer"/>
<element maxOccurs="1" minOccurs="0"
name="firstPage" type="boolean"/>
<element maxOccurs="1" minOccurs="0" name="lastPage" type="boolean"/>
</all>
</complexType>
<element name="FacetResponse" type="tns:FacetResponse"/>
<complexType name="contents">
<sequence>
<element maxOccurs="unbounded" minOccurs="0"
name="items" type="tns:MapStringToObject"/>
</sequence>
</complexType>
</schema>
我的 XML 输出是:
<ns0:facets_GET_Responses xmlns:ns0="http://www.example.org/xmlns/sapsaasconnection/SAPAriba/CATALOGCONTENT+facets_GET_Responses+286d4d67-dbb4-4187-ac9e-a9dd069c3035">
<ns0:Output>
<ns0:contents>
<ns0:items>
<ns0:count>42</ns0:count>
<ns0:ClassificationCode>UNSPSC:1000030</ns0:ClassificationCode>
</ns0:items>
</ns0:contents>
<ns0:limit>25</ns0:limit>
<ns0:offset>0</ns0:offset>
<ns0:totalElements>25</ns0:totalElements>
<ns0:totalPages>1</ns0:totalPages>
<ns0:firstPage>true</ns0:firstPage>
<ns0:lastPage>true</ns0:lastPage>
</ns0:Output>
</ns0:facets_GET_Responses>
我试图以我的方式分析它,但没有发现这里有什么问题。 任何人都可以按照 XSD 架构的预期提供帮助吗?
【问题讨论】:
标签: java xml xsd xsd-validation xml-validation