无法验证我的XML Agains XSD

肉毒杆菌

我正在尝试针对XSD验证简单的xml文件,但验证程序总是告诉我

'Cvc-elt.1:找不到元素'shipmentCreationRequest'的声明。行'3',列'36'。

我没有在SO上搜索并尝试了几种解决方案,但似乎没有任何作用,并且解决了我的问题...这是xml

<?xml version="1.0" encoding="UTF-8"?>
 <Test xmlns="http://www.w3schools.com"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema"
       xsi:schemaLocation="Request.xsd" >
 </Test>

这是XSD

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Request" xmlns:tns="http://www.example.org/Request" elementFormDefault="qualified">
 <element name="Test"></element>
</schema>

感谢您的帮助,问候。

克休斯

我认为您的实际错误消息可能是这样的:

cvc-elt.1.a: Cannot find the declaration of element 'Test'.

将您的XML更改为:

<?xml version="1.0" encoding="UTF-8"?>
<Test xmlns="http://www.example.org/Request"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema"
      xsi:schemaLocation="http://www.example.org/Request Request.xsd" >
</Test>

并将您的XSD更改为:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.example.org/Request"
        xmlns:tns="http://www.example.org/Request"
        elementFormDefault="qualified">
  <element name="Test"></element>
</schema>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章