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

发布于 2024-11-02 09:33:06 字数 2017 浏览 6 评论 0原文

 [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

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

如果您遇到过此类问题,请帮助我。

 [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

I try to export a report to PDF which is in XML format with a column that has more than 100,000 characters. The export fails and I get a SAXException. We are using fop 0.95.

Please help me if you had encountered such problem.

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

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

发布评论

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

评论(1

苏别ゝ 2024-11-09 09:33:06

这似乎在 FOP 常见问题解答中进行了讨论:

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

解决方法是在 Transformer 上设置显式 ErrorListener

更多详细信息可以在上面的链接中找到。

This seems to be discusses in the FOP FAQ:

This exception is usually a follow-up error after another exception. Sometimes the original exception gets swallowed by Xalan's default ErrorListener (should be fixed in the latest Xalan release).

The work-around is to set an explicit ErrorListener on the Transformer.

More details can be found in the link above.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文