【问题】
docbook中,用fop从fo文件中生成对应的pdf文件过程中,出错了:
fop --execdebug -c E:/Dev_Root/docbook/dev/config/fop/conf/fop.xconf ../output/fo/regular_expression.fo -pdf ../output/pdf/regular_expression.pdf exec "/cygdrive/c/Program Files (x86)/Java/jre7/bin/java" -classpath "E:/Dev_Root/docbook/tools/fop-1.0/lib/xmlgraphics-commons-1.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-ext-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xml-apis-1.3.04.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xercesImpl-2.7.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/xalan-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/serializer-2.7.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/fop-hyph.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-logging-1.0.4.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/commons-io-1.3.1.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/batik-all-1.7.jar;E:/Dev_Root/docbook/tools/fop-1.0/lib/avalon-framework-4.2.0.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-sandbox.jar;E:/Dev_Root/docbook/tools/fop-1.0/build/fop-hyph.jar" org.apache.fop.cli.Main "-c" "E:/Dev_Root/docbook/dev/config/fop/conf/fop.xconf" "../output/fo/regular_expression.fo" "-pdf" "../output/pdf/regular_expression.pdf" 十二月 09, 2012 5:57:56 下午 org.apache.fop.apps.FopFactoryConfigurator configure INFO: Default page-height set to: 11in 十二月 09, 2012 5:57:56 下午 org.apache.fop.apps.FopFactoryConfigurator configure INFO: Default page-width set to: 8.26in [Fatal Error] :-1:-1: Premature end of file. 十二月 09, 2012 5:57:58 下午 org.apache.fop.cli.Main startFOP SEVERE: Exception org.apache.fop.apps.FOPException: org.xml.sax.SAXParseException; Premature end of file. javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; Premature end of file. at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:302) at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130) at org.apache.fop.cli.Main.startFOP(Main.java:174) at org.apache.fop.cli.Main.main(Main.java:205) Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; Premature end of file. at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501) at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299) ... 3 more
【解决过程】
1.网上搜了下,参考:
SAXParseException: Premature end of file
和
Solution for org.xml.sax.SAXParseException:
然后想到了,其看看对应的fo文件。
2.巧了,一下就发现问题所在了。
对应的所要处理的fo文件:regular_expression.fo,是0KB,所以必然会出错。
原因是,之前由于硬盘满了,导致无法生成新的fo文件。
后来用于编译docbook的脚本就停止了。
然后重新编译时,没有clean,就去继续make。
也没想到,之前的没法继续编译之前,竟然会有0KB的fo会产生的。
3.所以,去删除对应的0KB的fo文件,重新编译,即可。
【总结】
很多事情,真的是没遇到之前,是想不到的。。。
转载请注明:在路上 » 【已解决】docbook中,用fop从fo文件生成pdf过程中出错:org.apache.fop.apps.FOPException: org.xml.sax.SAXParseException; Premature end of file