当我将报告导出为包含100,000个字符的PDF格式时,我收到SAXException

时间:2011-04-19 11:38:42

标签: java apache-fop

 [org.xml.sax.SAXException: Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root (http://www.w3.org/1999/XSL/Format)]
javax.xml.transform.TransformerException: org.xml.sax.SAXException: Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root (http://www.w3.org/1999/XSL/Format)
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:725)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2243)
    at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2069)
    at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1171)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:634)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1088)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1066)
    at com.ca.calm.reporter.pdf.PDFGenerator.buildPdf(PDFGenerator.java:1132)
    at com.ca.calm.reporter.pdf.PDFGenerator.generatePdf(PDFGenerator.java:848)
    at com.ca.calm.reporter.pdf.PDFGenerator.exportReport(PDFGenerator.java:626)
    at calmReporter.exportReport(calmReporter.java:521)
    at calmReporter.handleRequest(calmReporter.java:161)
    at com.ca.elm.common.sponsor.SponsorBase.Run(SponsorBase.java:159)
Caused by: org.xml.sax.SAXException: Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root (http://www.w3.org/1999/XSL/Format)
    at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:335)
    at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
    at org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:307)
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716)
    ... 12 more

我尝试将报告导出为PDF格式,其格式为XML格式,列数超过100,000个字符。导出失败,我得到一个SAXException。我们使用的是fop 0.95。

如果遇到这样的问题,请帮助我。

1 个答案:

答案 0 :(得分:2)

这似乎在FOP FAQ中讨论:

  

此异常通常是另一个异常后的后续错误。有时原始异常会被Xalan的默认ErrorListener吞噬(应该在最新的Xalan版本中修复)。

解决方法是在ErrorListener上设置明确的Transformer

更多细节可以在上面的链接中找到。