开发者

How can I validate XML against an XSD with distinct imports and namespaces?

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 开发者_StackOverflow社区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!


Your schema defines a complex type called relationship but it doesn't define any elements named relationship. You'll want to add something like this to your first XSD:

<xs:element name="relationship" type="relationship" /> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜