2011-04-20 34 views
4

JAXB綁定當我運行XJC對docbook.xsd,我得到了很多的錯誤:我如何創建docbook的

parsing a schema... 
[ERROR] Property "Revision" is already defined. Use <jaxb:property> to resolve this conflict. 
    line 5965 of file:/C:/log/11/04/20/docbook-4.5/dbpoolx.xsd 

[ERROR] The following location is relevant to the above error 
    line 521 of file:/C:/log/11/04/20/docbook-4.5/dbpoolx.xsd 

[ERROR] Element "seealsoie" shows up in more than one properties. 
    line 1737 of file:/C:/log/11/04/20/docbook-4.5/dbhierx.xsd 

[ERROR] The following location is relevant to the above error 
    line 1733 of file:/C:/log/11/04/20/docbook-4.5/dbhierx.xsd 

[ERROR] Element "imageobjectco" shows up in more than one properties. 
    line 3526 of file:/C:/log/11/04/20/docbook-4.5/dbpoolx.xsd 

[ERROR] The following location is relevant to the above error 
    line 3525 of file:/C:/log/11/04/20/docbook-4.5/dbpoolx.xsd 

....等。

我試過這與docbook版本4.5和版本5.0,但具有相同的結果。

任何指針都會被摺疊。 謝謝。

回答

8

您可以使用下面的綁定與文件的DocBook version 5 XML Schema

binding.xml

<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" 
    jxb:extensionBindingPrefixes="xjc" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xml="http://www.w3.org/XML/1998/namespace" 
    xmlns:docbook="http://docbook.org/ns/docbook" 
    version="2.1"> 


    <jxb:globalBindings> 
     <xjc:simple /> 
    </jxb:globalBindings> 

    <jxb:bindings schemaLocation="docbook.xsd"> 
      <jxb:bindings node="//xs:attributeGroup[@name='db.common.attributes']/xs:attribute[@name='version']"> 
       <jxb:property name="commonVersion"/> 
      </jxb:bindings> 
      <jxb:bindings node="//xs:attributeGroup[@name='db.common.attributes']/xs:attribute[@name='revision']"> 
       <jxb:property name="commonRevision"/> 
      </jxb:bindings> 
      <jxb:bindings node="//xs:attributeGroup[@name='db.common.attributes']/xs:attribute[@ref='xml:lang']"> 
       <jxb:property name="xmlLang"/> 
      </jxb:bindings> 
      <jxb:bindings node="//xs:attributeGroup[@name='db.common.linking.attributes']/xs:attribute[@ref='xlink:role']"> 
       <jxb:property name="xlinkRole"/> 
      </jxb:bindings> 
      <jxb:bindings node="//xs:attributeGroup[@name='db.common.linking.attributes']/xs:attribute[@ref='xlink:type']"> 
       <jxb:property name="xlinkType"/> 
      </jxb:bindings> 
      <jxb:bindings node="//xs:attributeGroup[@name='db.common.linking.attributes']/xs:attribute[@ref='xlink:title']"> 
       <jxb:property name="xlinkTitle"/> 
      </jxb:bindings> 
      <jxb:bindings node="//xs:element[@name='table']/xs:complexType/xs:attribute[@name='title']"> 
       <jxb:property name="titleAttribute"/> 
      </jxb:bindings> 
    </jxb:bindings> 
</jxb:bindings> 

的命令行,以包括綁定是:

xjc -extension -d out -b binding.xml docbook.xsd