2012-07-16 51 views
0

我有以下XML:不能包含XML架構

<xs:schema attributeFormDefault="unqualified" 
      elementFormDefault="qualified" 
      xmlns="http://www.testuri.org" 
      targetNamespace="http://www.testuri.org" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
<xs:element name="Price"> 
    <xs:complexType> 
    <xs:sequence> 
     <xs:element name="Value" type="xs:double" /> 
     <xs:element name="Currency" type="cs:string" /> 
    </xs:sequence> 
    </xs:complexType> 
</xs:element> 
</xs:schema> 

而且我要在另一個XML文件包括使用它;我宣佈

<xs:include schemaLocation="Price.xsd"/> 

,但我看到一個錯誤「在你的文件從該位置引用的模式包含錯誤」。正如我在上面看到的架構,我沒有看到它的任何錯誤。爲什麼會發生這種情況以及如何解決它?

回答

0

取而代之的元素應該有類型,如果我仍然需要元素,我應該在同一個文件中使用

<xs:element name="Price" type="Price"/> 

0

有一個關閉</xs:simpleType>沒有相應的開始標記。

編輯:刪除後,我進一步閱讀,發現<xs:element name="Currency" type="cs:string" />這可能應該閱讀<xs:element name="Currency" type="xs:string" />

+0

你是對的,那裏有另一個聲明,我的錯誤。即使沒有這個,錯誤仍然存​​在。對不起,晚點... – Anton 2012-07-16 17:26:08