问题描述
我的目录.xml
<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<public
publicId="-//EG//DTD EG DITA Map//EN"
uri="dtds/maps.dtd"/>
<public
publicId="-//EG //DTD EG DITA Composite//EN"
uri="dtds/topics.dtd"/>
</catalog>
预期的 DTD:
<!DOCTYPE concept PUBLIC "-//EG//DTD EG DITA Composite//EN" "../../system/dtd/client/eg-dita.dtd">
<!DOCTYPE docmap PUBLIC "-//EG//DTD EG DITA Map//EN" "../../system/dtd/client/eg-docmap.dtd">
文件存储布局(Windows 7):
the filestore layout (windows 7):
F:\export\catalog.xml
F:\export\*.xsl
F:\export\saxon9he.jar
F:\export\resolver.jar
F:\export\dtds\maps.dtd
F:\export\dtds\topics.dtd
F:\export\test\*.xml
F:\export\test\folders\*.xml
控制台输出:
Loading catalog: \catalog.xml
Saxon-HE 9.6.0.4J from Saxonica
Java version 1.7.0_09
Stylesheet compilation time: 940.807978ms
Processing file:/F:/export/folders.xml
Using parser org.apache.xml.resolver.tools.ResolvingXMLReader
Building tree for file:/F:/export/folders.xml using class
net.sf.saxon.tree.tiny.TinyBuilder
Tree built in 3.841258ms
Tree size: 6 nodes, 0 characters, 6 attributes
Building tree for file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map using class net.sf.saxon.tree.tiny.TinyBuilder
Error at template on line 33 of maps.xsl:
I/O error reported by XML parser processing
file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map: F:\export\system\dtd\client\eg-docmap.dtd (cannot find path)
I/O error reported by XML parser processing file:/F:/export/test/532a1069faf343d79c4ad37f8339aeda.map: F:\export\system\dtd\client\
eg-docmap.dtd (cannot find path)
所以文件 F:/export/test/532a1069faf343d79c4ad37f8339aeda.ditamap
有 DTD <!DOCTYPE docmap PUBLIC "-//EG//DTD EG DITA Map//EN""../../system/dtd/client/eg-docmap.dtd">
并期望其 DTD 位于 F:\export\system\dtd\client\eg-docmap.dtd
我想让解析器查看 F:\export\dtds\maps.dtd
So the file F:/export/test/532a1069faf343d79c4ad37f8339aeda.ditamap
has the DTD <!DOCTYPE docmap PUBLIC "-//EG//DTD EG DITA Map//EN" "../../system/dtd/client/eg-docmap.dtd">
and expects its DTD to be at F:\export\system\dtd\client\eg-docmap.dtd
And I want to make the parser look at F:\export\dtds\maps.dtd
我是这样称呼它的:
java -cp "saxon9he.jar;resolver.jar" net.sf.saxon.Transform base.xml all_maps.xsl -t -catalog:"catalog.xml"> all_maps.xml
在输出中,它现在说这个(我之前没有 -t 选项):
And in the output, it says this now (I didnt have the -t option before):
Resolved public: -//EG //DTD EG DITA Map//EN
file:/F:/export/dtds/maps.dtd
Failed to create InputSource (java.io.FileNotFoundException: F:\export\dtds\maps.dtd (system cand file the file)): file:/F:export/dtds/maps.dtd
推荐答案
嗯,它应该有效.我没有看到 windows 在文件名中添加了一个额外的 .txt.删除它后,它就像一个魅力.
Well, it should have worked. I didnt see that windows had added an extra .txt to the file names. After removing that, it worked like a charm.
命令行如题,目录文件如题.
Command-line as shown in the questions, catalog file as shown in the question.
这篇关于将 saxon9he 与 catalog.xml 文件一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!