Apache FOP:解析为本地文档安装
我需要配置 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为问题在于目录文件中的 DOCTYPE 声明:
语法错误:它以
/>
结尾,而不是>
和一个右引号缺少。修复第 1 项后,解析器会尝试从
http://www.oasis-open.org/committees/entity
获取 DTD。该位置没有 DTD,解析器放弃。我做了一些测试,当我简单地从目录文件中删除整个
行时,事情开始按预期工作。
I think the problem is the DOCTYPE declaration in your catalog file:
The syntax is wrong: it ends with
/>
instead of>
and a closing quotation mark is missing.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.我通过简单地从要转换的文件中删除 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
我在catalog.xml 文件中使用此doctype 元素定义:
I use this doctype element definition in my catalog.xml file: