如何为 docbook 创建 JAXB 绑定

发布于 2024-11-02 13:34:25 字数 975 浏览 5 评论 0原文

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

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 尝试过此操作,但结果相同。

任何指示将不胜感激。 谢谢。

When I run xjc against docbook.xsd, I get a lot of errors:

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.

I've tried this with docbook version 4.5 and version 5.0, but with the same result.

Any pointers would be apreciated.
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下壹個目標 2024-11-09 13:34:25

您可以将以下绑定文件与 DocBook 版本 5 XML 架构 结合使用:

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

You could use the following bindings file with the 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>

The command line to include the bindings is:

xjc -extension -d out -b binding.xml docbook.xsd
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文