[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] "Heap" of trouble handling input file of 500 MByte


Subject: Re: [xsl] "Heap" of trouble handling input file of 500 MByte
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 22 Feb 2011 09:49:05 +0000

On 21 February 2011 21:24,  <thehulk@xxxxxxxxxxx> wrote:
> Thanks for all these suggestions. I tried to use Saxon but ran into typical problems.

What are the typical problems?

> I have not found an endorsed dir anywhere, and after looking at about a dozen webpages, I am ready to give up and ask: how to put it > into the endorsed dir?

Drop the saxon jar into [java-home]/lib/endorsed, the endorsed
mechanism is the standard way to override classes in the jdk,
specifically TransformerFactory in this case.

> Also very usable: how to make this one program use the Saxon classes?

That was the alternative approach (which is what I do all the time
anyway), instead of:

TransformerFactory tFactory = TransformerFactory.newInstance();

do

TransformerFactory tFactory = new net.sf.saxon.TransformerFactoryImpl();

The former will return whichever TransformerFactory impl it finds
first on the classpath, which is Xalan by default, but will be Saxon
if the Saxon jar is in the endorsed directory.

The latter will always use Saxon.

For what its worth, you'll often hear Mike say use the separate
version of Xerces rather than the one bundled with Java, and you can
do that in a similar way - either drop it into the endorsed dir, or
explicitly create it with:

XMLReaderFactory xmlReader =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"
);

or just create the SAXParser directly.


-- 
Andrew Welch
http://andrewjwelch.com


Current Thread