XSD 验证错误:找不到元素“soapenv:Envelope"的声明 [英] XSD validation error: Cannot Find The Declaration Of Element 'soapenv:Envelope'

查看:29
本文介绍了XSD 验证错误:找不到元素“soapenv:Envelope"的声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 http://www.freeformatter 来根据我的 XSD 验证我的 XML.com/xml-validator-xsd.html 但它因上述错误而失败.我发现了许多相同的问题,但没有一个答案对我有帮助.请帮忙,什么是正确的 XML/XSD?

I try to validate my XML against my XSD using http://www.freeformatter.com/xml-validator-xsd.html but it fails with the error above. I found many of the same questions but none of the answers helped me. Please help, what is the correct XML/XSD?

我的 XML:(只有最小的一个)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope" >
</soapenv:Envelope>

我的 XSD:(只有最小的一个)

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  >
</xs:schema>  

推荐答案

几个问题:

  • 您的 XML 没有暗示 XSD 的位置.

  • Your XML does not hint as to the location of an XSD.

补救措施:使用 xsi:schemaLocation(参见下面的 XSD).

Remedy: Use xsi:schemaLocation (see XSD below).

您用于 SOAP 的 XML 命名空间 URI 是非标准的.

Your XML namespace URI for SOAP is non-standard.

补救措施:使用http://schemas.xmlsoap.org/soap/envelope/(注意尾部斜杠).

Remedy: Use http://schemas.xmlsoap.org/soap/envelope/ (note trailing slash).

您的 XSD 没有定义 targetNamespace.

Your XSD does not define a targetNamespace.

补救措施:定义一个,或者更好的是,使用 标准架构SOAP/1.1 信封.

Remedy: Define one, or better yet, use the standard Schema for the SOAP/1.1 envelope.

您可以使用以下空 SOAP 信封消息来检查您的消息;它将消除您的错误并允许找到 soapenv:Envelope 的声明:

You can use the following null SOAP envelope message to check your message; it will eliminate your error and allow the declaration of soapenv:Envelope to be found:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
                                      http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
  <soapenv:Body/>
</soapenv:Envelope>

这篇关于XSD 验证错误:找不到元素“soapenv:Envelope"的声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆