明確なインポートと名前空間でXSDに対してXMLを検証するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/2959571

質問

私はいくつかのXMLファイルを検証しようとしていますが、XSD定義と名前空間に関するさまざまな問題のために失敗しています...

これは公開情報なので、データの共有に問題ありません:メインXSDは http://bioinformatics.ua.pt/euadr/euadr_types.xsd 名前付き同じ場所に別のXSDをインポートします common_types.xsd, 、私はそれらをW3C Validatorで検証し、彼らは合格しました。

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の?

よろしくお願いします!

乾杯!

役に立ちましたか?

解決

スキーマは、呼ばれる複雑なタイプを定義します relationship ただし、名前の要素は定義されていません relationship. 。このようなものを最初のXSDに追加してください。

<xs:element name="relationship" type="relationship" /> 
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top