我是使用Jaxb插件生成模型的新手。我有2个xsd文件,其中一个xsd在其他xsd中引用类型
common.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.example.com/schemas/common"
version="1.0" xmlns="http://www.example.com/schemas/common"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="person">
<xsd:sequence>
<xsd:element minOccurs="1" name="gender" type="xsd:string"/>
<xsd:element minOccurs="1" name="dateOfBirth" type="xsd:string"/>
<xsd:element minOccurs="1" name="name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
pupil.xsd ,它引用了 common.xsd
中定义的人<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.example.com/schemas/pupil" version="1.0"
xmlns:common="http://www.example.com/schemas/common"
xmlns="http://www.example.com/schemas/pupil" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.example.com/schemas/common" schemaLocation="http://www.example.com/domain/schemas/common/common.xsd"/>
<xsd:complexType name="student">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="class" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="generralInfo" type="common:person"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
catalog.cat ,尝试使用插件的剧集功能
REWRITE_SYSTEM “ http://www.example.com/domain/schemas/common/common.xsd”“。
pom.xml ,这是我的Maven构建配置
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<configuration>
<extension>true</extension>
<catalog>src/main/resources/catalog.cat</catalog>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
当我运行mvn clean install
时,我正在关注
错误
[ERROR]解析架构时出错。位置[ http://www.example.com/domain/schemas/common/common.xsd {XXX,XX}]。 org.xml.sax.SAXParseException; systemId: http://www.example.com/domain/schemas/common/common.xsd;电话号码: XXX; columnNumber:XXX; “人”已经定义
我尝试使用here中提到的各种选项来解决此错误,但这对我有帮助。我认为我在绑定配置或pom配置中做错了
有人可以指出这里有什么问题吗