2012-10-25 5 views
3

xsd 파일에서 java 소스 코드를 생성하는 데 jaxb를 사용하고 있습니다.개별 xsd 요소에 jaxb 바인딩을 사용할 수 없습니다.

[ERROR] ****/src/main/xjb/common.xjb[8,24] 
com.sun.istack.SAXParseException2: compiler was unable to honor this schemaBinding customization. It is attached to a wrong place, or its inconsistent with other bindings. 

내 바인딩 파일 common.xjb 시도 :

나는 내가 다음과 같은 오류가 얻을 소스를 생성하지만 때마다 소스가 요소별로에서 생성 된 패키지를 지정할 수 있도록하려면

<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 

    <jxb:bindings schemaLocation="../xsd/common/common.xsd" node="/xs:schema"> 

     <jxb:bindings node="//xs:element[@name='api']"> 
      <jxb:schemaBindings> 
       <jxb:package name="com.myxml.common.api" /> 
      </jxb:schemaBindings> 
     </jxb:bindings> 

    </jxb:bindings> 

</jxb:bindings> 

내 XSD 파일 common.xsd은 다음과 같습니다 :

이름 (속성 값) 패키지 'com.myxml.common.api'에서 'API'와 요소를 배치

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>jaxb2-maven-plugin</artifactId> 
    <version>1.5</version> 

    <executions> 
     <execution> 
      <id>schema00-generate</id> 
      <phase>generate-sources</phase> 
      <goals> 
       <goal>xjc</goal> 
      </goals> 
      <configuration> 
       <schemaFiles>common/common.xsd</schemaFiles> 
       <bindingFiles>common.xjb</bindingFiles> 
       <bindingDirectory>${project.basedir}/src/main/xjb</bindingDirectory> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

가 왜이 오류가 무엇입니까이며 어떻게 그것을 해결할 수 : 6,113,210

그리고 나는 모든 가야 다음 Maven 플러그인을 사용하고 있습니다? 내가 알고있는이 단계에서 다른 바인딩을 사용할 필요가 없습니다.

답변

3

동일한 네임 스페이스의 요소를 다른 패키지에 매핑 할 수 없으므로 패키지를 최상위 수준 이외의 항목으로 정의 할 수 없습니다.