如何针对具有不同导入和命名空间的 XSD 验证 XML?
我正在尝试验证一些 XML 文件,但由于 XSD 定义和命名空间的各种问题而失败...
这是公共信息,因此共享数据没有问题:主要 XSD 位于 http://bioinformatics.ua.pt/euadr/euadr_types.xsd 并在同一位置导入另一个 XSD名为 common_types.xsd,我已在 W3C 验证器中验证了它们,并且它们通过了。
XML
<?xml version="1.0"?>
<relationship xmlns="http://euadr.biosemantic.erasmusmc.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://euadr.biosemantic.erasmusmc.org/ http://bioinformatics.ua.pt/euadr/euadr_types.xsd">
<sourceId>
<source>SMILE</source>
<code>[S]1(=O)(=O)N(C(</code>
</sourceId>
<targetId>
<source>UP</source>
<code>P35354</code>
</targetId>
<creator>http://cgl.imim.es</creator>
<observationDateTime>2010-05-12T19:03:40.097+02:00</observationDateTime>
<informationSources>
<informationSource>
<relationshipType>BINDS</relationshipType>
<interaction>
<type>pIC50</type>
<value>6.55</value>
</interaction>
<evidence>
<type>OBSERVATIONAL</type>
<value>1.0</value>
</evidence>
<databaseIds>
<databaseId>
<source>PDSP</source>
<code>
P35354</code>
</databaseId>
</databaseIds>
</informationSource>
</informationSources>
</relationship>
简单明了且格式良好!我测试了一些在线验证器,并且收到以下错误
cvc-elt.1: Cannot find the declaration of element 'relationship'.
有人知道问题是什么吗?它在命名空间的声明中吗? XSD 的?
预先感谢您的帮助!
干杯!
I am trying to validate a few XML files and I'm failing due to various issues with the XSD definition and the namespaces...
This is public info, so no problem sharing data: the main XSD is at http://bioinformatics.ua.pt/euadr/euadr_types.xsd and it imports another XSD at the same location named common_types.xsd, I've validated them in W3C validator, and they passed.
The XML
<?xml version="1.0"?>
<relationship xmlns="http://euadr.biosemantic.erasmusmc.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://euadr.biosemantic.erasmusmc.org/ http://bioinformatics.ua.pt/euadr/euadr_types.xsd">
<sourceId>
<source>SMILE</source>
<code>[S]1(=O)(=O)N(C(</code>
</sourceId>
<targetId>
<source>UP</source>
<code>P35354</code>
</targetId>
<creator>http://cgl.imim.es</creator>
<observationDateTime>2010-05-12T19:03:40.097+02:00</observationDateTime>
<informationSources>
<informationSource>
<relationshipType>BINDS</relationshipType>
<interaction>
<type>pIC50</type>
<value>6.55</value>
</interaction>
<evidence>
<type>OBSERVATIONAL</type>
<value>1.0</value>
</evidence>
<databaseIds>
<databaseId>
<source>PDSP</source>
<code>
P35354</code>
</databaseId>
</databaseIds>
</informationSource>
</informationSources>
</relationship>
is straightforward and well-formed! I've tested a few online validators, and I'm getting the following error
cvc-elt.1: Cannot find the declaration of element 'relationship'.
Does anyone has any idea of what the problem is? Is it in the declaration of the namespaces? Of the XSD?
Thanks in advance for your help!
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的架构定义了一个名为
relationship
的复杂类型,但它没有定义任何名为relationship
的元素。您需要将如下内容添加到您的第一个 XSD 中:Your schema defines a complex type called
relationship
but it doesn't define any elements namedrelationship
. You'll want to add something like this to your first XSD: