0
我想驗證一些XML文件,並且因爲XSD定義和命名空間的各種問題而失敗...如何使用不同的導入和名稱空間驗證XML與XSD?
這是公共信息,因此共享數據沒有問題:主XSD在http://bioinformatics.ua.pt/euadr/euadr_types.xsd並且它在名爲common_types.xsd的同一位置導入另一個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?
在此先感謝您的幫助!
乾杯!
謝謝! 我已經成功地發現了一個類似的解決方案昨天... \t \t \t ... 這就提出了另一個問題:哪種解決方案(您的或我的)不會破壞現有的XML文件? –
2010-06-04 10:46:17