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