首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何为docbook创建JAXB绑定

如何为docbook创建JAXB绑定
EN

Stack Overflow用户
提问于 2011-04-20 14:20:08
回答 1查看 4.8K关注 0票数 4

当我对docbook.xsd运行xjc时,我得到了很多错误:

代码语言:javascript
复制
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

....etc。

我已经在docbook版本4.5和版本5.0上尝试过了,但是结果是一样的。

任何指针都将被删除。谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-04-21 04:35:10

您可以将以下绑定文件与DocBook version 5 XML Schema一起使用

binding.xml

代码语言:javascript
复制
<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>

包含绑定的命令行是:

代码语言:javascript
复制
xjc -extension -d out -b binding.xml docbook.xsd
票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5726277

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档