如何将XSD类型导入根模式?
这是我在foo.xsd
现有XSD架构, foo.xsd
声明了类型:
这是另一个声明元素的模式:
这是我从Java中的SAX解析器得到的:
"The namespace attribute 'foo' of an element information item must not be the same as the targetNamespace of the schema it exists in."
我究竟做错了什么?
当指定所涉及的XSD的targetNamespace(tns)属性且相同时,仅允许xsd:include(targetNamespace属性不能将空字符串作为其值)。
但是,可以包括没有来自具有tns的模式(s2)的tns的模式(s1); 净效果是s1组件假定s2模式的名称空间。 这种用法通常被称为变色龙组合物。
这里描述了两者之间差异的SO的参考。