(어쩌면 내가 ... 잘못된 키워드를 사용하고, 아무 대답도 이미 그것을 봤없는 한 여기 검색을 수행하고 있음)
a.xsd :를 b.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://foo.bar/something"
targetNamespace="http://foo.bar/something"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="TFoo">
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:schema>
:
간단한, 나는 두 스키마가모두 과 같음 targetNamespace 및 TFoo이라는 complexType이 있습니다.
A-binding.xml :
난 TFooA에 에서 TFoo을 a.xsd의 생성 된 클래스 이름을 변경하기 위해 외부 결합이<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
version="2.1">
<jxb:bindings schemaLocation="a.xsd">
<jxb:bindings node="//xs:complexType[@name='TFoo']">
<jxb:class name="TFooA"/>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
어느 a.xsd만의 경우 :
나는 한 번에 두 스키마를 컴파일하려고하면$ xjc -b a-binding.xml a.xsd
parsing a schema...
compiling a schema...
bar/foo/something/ObjectFactory.java
bar/foo/something/TFooA.java
bar/foo/something/package-info.java
,
(내가 TFoo 된 .java을 가지고 어떻게 보면)하지만, 내가 얻을 :
$ xjc -b a-binding.xml a.xsd b.xsd
parsing a schema...
[ERROR] 'TFoo' is already defined
line 13 of file:/home/scherrer/tmp/PL_008f/b.xsd
[ERROR] (related to above error) the first definition appears here
line 9 of file:/home/scherrer/tmp/PL_008f/a.xsd
Failed to parse a schema.
내가 TFoo을 알고은 두 번 정의되었으므로 충돌을 해결하기 위해 외부 바인딩을 사용합니다.
Obs. 두 스키마가 모두 허구이며, 문제의 원인을 설명하기 위해 작성되었으며, 실제 스키마는 제 3 자에 의해 제공되며 나는 변경할 수 없습니다.
아무도 xjc 제한 사항 (here은 표시되지 않음)이거나 전혀 작동하지 않아야한다고 말할 수 있습니까? 아니면 버그일까요?
미리 감사드립니다.
간단히 말해서,이 조합이 유효하지 않으므로이 두 스키마를 함께 컴파일 할 수 없습니다. – lexicore