JAXB multiple schemas with element reference(带有元素引用的 JAXB 多个模式)
问题描述
我有两个使用 JAXB 处理的模式.第一个模式经过预处理,并使用剧集文件使用此信息(遵循 http://www.java.net/blog/2006/09/05/separate-compilation-jaxb-ri-21).第二个模式导入第一个,并再次使用 jaxb 进行处理.这一切都按预期工作.
I have two schemas which are processed using JAXB. The first schema is preprocessed and information of this is used using an episode file (following http://www.java.net/blog/2006/09/05/separate-compilation-jaxb-ri-21). The second schema imports the first, and again using jaxb, is processed. This all works as expected.
但现在我在第一个模式中有一个元素,在第二个模式中使用引用.
But now I have an element in the first schema, which is used in the second using a reference.
架构 a:
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://www.example.org/Test/"
targetNamespace="http://www.example.org/Test/">
<element name="type" type="test:MyType"></element>
架构 b:
<schema elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:second="http://www.example.org/Second/"
xmlns:test="http://www.example.org/Test/"
targetNamespace="http://www.example.org/Second/">
<import namespace="http://www.example.org/Test/" />
<complexType name="SomeType">
<sequence>
<element ref="test:type" minOccurs="1" maxOccurs="unbounded" />
</sequence>
</complexType>
在处理过程中没有任何问题,但是为两种模式生成的代码提供了相同的方法:
During processing nothing is wrong, but the generated code for both schemas provide the same method:
public JAXBElement<EventType> createType(TypeType value)
在运行时,这会导致以下错误:
At runtime, this results in the following error:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions
The element name {http://www.example.org/Type
本文标题为:带有元素引用的 JAXB 多个模式


基础教程推荐
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 大摇大摆的枚举 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 多个组件的复杂布局 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01