[ https://issues.apache.org/jira/browse/XALANJ-2537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737909#comment-17737909 ]
Joe Kesselman commented on XALANJ-2537: --------------------------------------- Handling huge documents is a problem for any XSLT processor. XSLT 3.0 introduced the concept of a streaming subset of the language specifically for that purpose, and IBM has some patents (but not product as far as I know) on the topic of how to optimize/rewrite a stylesheet into a streamable form. That might or might not address this use case. If not, huge amounts of memory or partitioning the problem may be unavoidable. I believe Saxon does have some streaming capability, though I don't know how much. IBM's DB2 database does support XQuery, which is functionally equivalent to XSLT; I don't know whether it supports XSLT syntax. Since DB2 scales up to huge data structures, it might be able to run queries that Xalan will never be able to handle directly. > The SAX exception occurs in Tansformer.transform() for a very large xml > string as input. > ----------------------------------------------------------------------------------------- > > Key: XALANJ-2537 > URL: https://issues.apache.org/jira/browse/XALANJ-2537 > Project: XalanJ2 > Issue Type: Bug > Security Level: No security risk; visible to anyone(Ordinary problems in > Xalan projects. Anybody can view the issue.) > Components: SAX > Affects Versions: 2.7 > Environment: Linux > Reporter: Deepthi BakkaVemana > Priority: Blocker > Labels: sax_exception_for_Largexml > > We are using xalan 2.7.0 and fop 0.95 for generating PDF reports.While > generating pdf report for a large xml string of 2,96,126 characters(~ nearly > 3 lakh characters) ,the PDF generation fails and it fails at > transformer.transform() method in TransformerImpl.java.Since in our > product,we need large reports with very large strings(events),we need this > fix ASAP. > I et the below exception: 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:1312) > at > com.ca.calm.reporter.pdf.PDFGenerator.generatePdfForQueryView(PDFGenerator.java:1240) > at > com.ca.calm.reporter.pdf.PDFGenerator.exportPanel(PDFGenerator.java:186) > at calmReporter.exportPanel(calmReporter.java:421) > at calmReporter.handleRequest(calmReporter.java:161) > our code: > TransformerFactory factory = TransformerFactory.newInstance(); > Templates templates = factory.newTemplates(new > SAXSource(new InputSource( > new StringReader(xslContent)))); > Transformer transformer = templates.newTransformer(); > // Set the value of a <param> in the stylesheet > transformer.setParameter("versionParam", "2.0"); > Result res = new SAXResult(fop.getDefaultHandler()); > String parserClass = > "com.sun.org.apache.xerces.internal.parsers.SAXParser"; > if (((String) > System.getProperties().get("java.version")).startsWith("1.4")) > { > parserClass = > "org.apache.crimson.parser.XMLReaderImpl"; > } > //String parserClass = > "org.apache.crimson.parser.XMLReaderImpl"; > XMLReader reader = > XMLReaderFactory.createXMLReader(parserClass); > Source source = new SAXSource(reader, new > InputSource(bufferedInputStream)); > transformer.transform(source, res); - this is the > point of failure.. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org For additional commands, e-mail: dev-h...@xalan.apache.org