views:

26

answers:

1

Hi there!!

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"&gt;
  <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&lt;/creator&gt;
  <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!

A: 

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" /> 
Welbog
Thanks!I've managed to discover a similar solution yesterday... <xs:element name="relationship"> <xs:complexType> <xs:sequence>... </xs:element>This raises another issue: which solution (yours or mine) won't break existing XML files?
Pedro Lopes