我有两个 xsd 文件:
base.xsd:
<schema
targetNamespace="http://www.myorg.com/base"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2001/XMLSchema">
...
<complexType name="NrmClass">
...
</complexType>
...
</schema>
main.xsd是我们想要使用 base.xsd 中的类型的模式
<schema
targetNamespace="http://www.myorg.com/main"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xn="http://www.myorg.com/base">
<import namespace="http://www.myorg.com/base"/>
...
<element>
<complexType>
<complexContent>
<extension base="xn:NrmClass">
...
</extension>
</complexContent>
</complexType>
</element>
...
</schema>
当我尝试编译两者时,我收到以下错误:
> xjc base.xsd main.xsd
parsing a schema...
[ERROR] src-resolve: Cannot resolve the name 'xn:NrmClass' to a(n) 'type definition' component.
line 48 of file:/main.xsd
这里有什么问题?