【发布时间】:2017-07-19 00:45:35
【问题描述】:
我有一个服务的 xsd 文件,其中命名空间在顶层定义为 -
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace= "http://www.ycompany.net/"
xmlns="http://www.ycompany.net/"
elementFormDefault="qualified">
然后整个xsd中就没有命名空间了。
但是如果我看到这个服务的 XML 响应,参数的名称是正确的,但是每个元素都有完全不同的命名空间。例如
<a:getScooterListResponse xmlns:a="http://com/ngr/pumba/vip/service/ycompany/grammars/pclst" xmlns:b="java:ycompany.grammars.pclst.structures.messages" xmlns:c="java:ycompany.grammars.pclst.structures.groups" xmlns:d="java:ycompany.grammars.pclst.structures.segments" xmlns:e="java:ycompany.grammars.pclst.structures.composites" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<a:return>
<b:OrFiltersQuery>
<c:Dummy>
<d:DummyByte>0</d:DummyByte>
</c:Dummy>
<c:AndFiltersQuery>
<c:ScooterListFilterName>
<d:AttributeDetails>
<e:AttributeType>FQA</e:AttributeType>
</d:AttributeDetails>
</c:ScooterListFilterName>
</c:AndFiltersQuery>
</b:OrFiltersQuery>
.
.
.
我的问题是,是否有可能在 xsd 和实际响应中有不同的命名空间,或者这个 xml 是否用于不同的 xsd?
【问题讨论】:
-
如果没有人验证 XSD 是很有可能的。或者,如果架构中有
xsd:any元素。 msdn.microsoft.com/en-us/library/ms256043(v=vs.110).aspx -
请注意,这看起来是一个序列化的肥皂消息,而不是 XSD 描述的 XML。
标签: xml xsd xml-namespaces