2012-07-16 47 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