从SOAP响应XML生成XSD

从SOAP响应XML生成XSD,xml,soap,xsd,Xml,Soap,Xsd,我有一个SOAP响应XML,我需要一个用于该XML的XSD。我已经尝试过在线转换、XMLBeans和java,但我的XML没有得到合适的XSD。有人能告诉我怎么做转换吗。 SOAP响应XML如下所示: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns

我有一个SOAP响应XML,我需要一个用于该XML的XSD。我已经尝试过在线转换、XMLBeans和java,但我的XML没有得到合适的XSD。有人能告诉我怎么做转换吗。 SOAP响应XML如下所示:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
    <ns1:sessionID soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="http://ws.polarion.com/session">-1897751301705602409</ns1:sessionID>
</soapenv:Header>
<soapenv:Body>
    <logInResponse xmlns="http://ws.polarion.com/SessionWebService-impl"/>
</soapenv:Body>

-1897751301705602409

获得“适当”的XSD是只有人类才能做到的事情:您需要理解XML表示的数据模型。例如,在您的示例中,logInResponse元素为空,但只有您可以决定它是否始终为空

如果您并不真正关心验证规则是什么,只是为了勾选框而需要一个模式,那么您总是可以使用一个通用模式来允许任何事情。不幸的是,这并不像应该的那么容易,因为严格的模式验证器坚持模式必须为最外层的元素声明一个显式的全局元素。所以最小模式类似于

<xs:element name="logInResponse"/>

(当然是在右边的targetNamespace中)