这是我现有的XSD架构foo.xsd,它只声明了类型:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="foo">
<xs:complexType name="alpha">
<!-- skipped -->
</xs:complexType>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
这是另一个声明元素的模式:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="foo">
<xs:import schemaLocation="foo.xsd" namespace="foo" />
<xs:element name="RootElement" type="alpha"/>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
这是我从Java中的SAX解析器得到的:
"The namespace attribute 'foo' of an <import> element information
item must not be the same as the targetNamespace of the schema it exists in."
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?