2013-01-19 75 views
1

我正在使用eclipse編輯和XML模式文件。我有兩個文件,文件一和文件二。 文件似乎是好的,但由於文件二引用文件二(外鍵),我有這個錯誤。雖然從代碼可以看出,文件1有namespace。我需要一些幫助。我試圖驗證xml模式文件,但給了我一個錯誤

src-resolve.4.1: Error resolving component 'pk_Top_200_Queries2'. 
It was detected that 'pk_Top_200_Queries2' has no namespace, 
but components with no target namespace are not referenceable 
from schema document 
'file:///C:/java/workspace2/HomeWork2/Clicked_and_pos_12.xsd'. 
If 'pk_Top_200_Queries2' is intended to have a namespace, perhaps 
a prefix needs to be provided. If it is 
intended that 'pk_Top_200_Queries2' has no namespace, then 
an 'import' without a "namespace" attribute should be added to 
'file:///C:/java/workspace2/HomeWork2/Clicked_and_pos_12.xsd'. 

文件1:名稱= Top_200_Queries2和架構低於

<?xml version="1.0" encoding="UTF-8"?> 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.example.org/Top_200_Queries2" 
xmlns="http://www.example.org/Top_200_Queries2" 
elementFormDefault="qualified"> 


<xsd:element name="T200Q"> 

<xsd:complexType> 

<xsd:sequence> 
<xsd:element name="t200q" maxOccurs="200"> 
<xsd:complexType> 
<xsd:sequence> 

<xsd:element name="qid" type="xsd:string" /> 
<xsd:element name="query" type="xsd:string" /> 
<xsd:element name="count" type="xsd:integer" /> 
</xsd:sequence> 
</xsd:complexType> 
</xsd:element> 
</xsd:sequence> 
</xsd:complexType> 
<xsd:key name="pk_qid"> 

<xsd:selector xpath=".//t200q" /> 
<xsd:field xpath="qid" /> 
</xsd:key> 

</xsd:element> 
</xsd:schema> 

FIEL 2名= Clicked2.xsd

<?xml version="1.0" encoding="UTF-8"?> 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.example.org/Clicked2" 
xmlns="http://www.example.org/Clicked2" elementFormDefault="qualified"> 



<xsd:element name = "Clicked2"> 
<xsd:complexType> 
<xsd:sequence> 
<xsd:element name = "clicks" maxOccurs="unbounded"> 
<xsd:complexType> 
<xsd:sequence> 
<xsd:element name="qid" type="xsd:string"/> 
<xsd:element name="uid" type="xsd:integer"/> 
</xsd:sequence> 
</xsd:complexType> 
</xsd:element> 
</xsd:sequence> 
</xsd:complexType> 

<xsd:key name="pk_Clicked2"> 
<xsd:selector xpath=".//clicks"/> 
<xsd:field xpath="qid"/> 
<xsd:field xpath="uid"/> 
</xsd:key> 
<xsd:keyref name="fk_contains_query" refer="pk_Top_200_Queries2"> 
<xsd:selector xpath=".//clicks"/> 
<xsd:field xpath="qid"/> 
</xsd:keyref> 

<xsd:keyref name="fk_contains_url" refer="pk_URL"> 
<xsd:selector xpath=".//clicks"/> 
<xsd:field xpath="uid"/> 
</xsd:keyref> 
</xsd:element> 
</xsd:schema> 

兩個文件都在同一個包中蝕。

回答

0

您提供了兩個文件,其名稱是Top_200_Queries2Clicked2.xsd。乍一看,它們看起來很好。

您引用的錯誤消息沒有提及這些文件名中的任何一個,而是提到了名爲pk_Top_200_Queries2Clicked_and_pos_12.xsd的文件。因此,第一個要問的問題是:處理器實際上是在讀取您想要讀取的文件,還是正在讀取其他模式文件?

相關問題