Apache FOP:解析为本地文档安装

发布于 2024-10-17 12:02:09 字数 1101 浏览 1 评论 0原文

我需要配置 Apache FOP,以便它使用我的本地 docbook dtd 文件等。我尝试了几乎所有方法,从编写目录文件到安装 apache xml 解析器等。

这是我编写的目录文件。我还为此文件设置了 xml.catalog.files 属性,并且 实例化了 FopFactory 用作 URIResolver 的 apache 目录解析器。但纨绔子弟仍然从网上获取一切。

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group  prefer="public"  xml:base="file:///Users/raichoo/">
  <public publicId="-//OASIS//DTD DocBook XML V4.5//EN" uri="docbook/docbookx.dtd" />
  <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" uri="docbook/docbookx.dtd" />
  <system systemId="http://www.oasis-open.org/docbook/xml/4.5/" uri="docbook/" />
  <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.5/" rewritePrefix="docbook/"/>
</group>                                                                                                                      

</catalog>

有什么想法出了什么问题吗?

问候, 雷鸟

I need to configure Apache FOP so that it uses my local docbook dtd files etc. I tried pretty much everything from writing a catalog file to installing apache xml resolver etc

Here is the catalog file I wrote. I also set the xml.catalog.files property to this file and
instantiated an apache catalog resolver that the FopFactory uses as URIResolver. But the fop still fetches everything from the net.

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<group  prefer="public"  xml:base="file:///Users/raichoo/">
  <public publicId="-//OASIS//DTD DocBook XML V4.5//EN" uri="docbook/docbookx.dtd" />
  <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN" uri="docbook/docbookx.dtd" />
  <system systemId="http://www.oasis-open.org/docbook/xml/4.5/" uri="docbook/" />
  <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.5/" rewritePrefix="docbook/"/>
</group>                                                                                                                      

</catalog>

Any ideas what's going wrong?

Regards,
raichoo

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

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

发布评论

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

评论(3

捶死心动 2024-10-24 12:02:09

我认为问题在于目录文件中的 DOCTYPE 声明:

  1. 语法错误:它以 /> 结尾,而不是 > 和一个右引号缺少。

  2. 修复第 1 项后,解析器会尝试从 http://www.oasis-open.org/committees/entity 获取 DTD。该位置没有 DTD,解析器放弃。

我做了一些测试,当我简单地从目录文件中删除整个 行时,事情开始按预期工作。

I think the problem is the DOCTYPE declaration in your catalog file:

  1. The syntax is wrong: it ends with /> instead of > and a closing quotation mark is missing.

  2. With item 1 fixed, the resolver tries to fetch the DTD from http://www.oasis-open.org/committees/entity. There is no DTD at that location, and the resolver gives up.

I did some tests, and when I simply removed the whole <!DOCTYPE ..> line from the catalog file, things started working as expected.

幽蝶幻影 2024-10-24 12:02:09

我通过简单地从要转换的文件中删除 DOCTYPE 解决了这个问题。不完全是一个漂亮的解决方案,但我无法说服 FOP 解析 URI。

问候,雷丘

I solved the problem by simply removing the DOCTYPE from the file to transform. Not exactly a pretty solution but I could not convince to FOP to resolve the URIs.

Regards, raichoo

俏︾媚 2024-10-24 12:02:09

我在catalog.xml 文件中使用此doctype 元素定义:

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
 ...
</catalog>

I use this doctype element definition in my catalog.xml file:

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
 ...
</catalog>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文