Good day,
I'm having some peculiar problems with large files. I do the following:
XMLWriter writer = new XMLWriter(System.out,
OutputFormat.createPrettyPrint());
For small files, all works fine. For the biggest, I get errors -- the
output is abruptly truncated, in the middle of an element: as if someone
has taken a pair of scissors and chopped the listing in half. For a given
document, this happens always in the same place, and is unaffected by heap
settings (-Xmx150M has the same result as -Xmx 16M).
Replacing System.out with
new BufferedOutputStream (new FileOutputStream ("ParseTest.out"))
has no effect - the file is truncated in exactly the same place.
FWIW, at startup I get the following message printed to stdout:
Warning: Error occurred using JAXP to load a SAXParser. Will use Aelfred
instead
Bizarrely, System.out.println (doc.asXML()) works fine, except for CRLF/LF
issues.
How can I track this truncation problem down - any suggestions?
System: dom4j-coming-soon-0.5 daily snapshot grabbed on 2001-06-15
Mandrake Linux 7.2, Sun JDK 1.3.0_02, 256Mb RAM, AMD Duron 800 (etc etc...)
CLASSPATH:
/home/thomasn/src/dx2/classes:/usr/local/dom4j-coming-soon-0.5/dom4j-full.jar:/usr/local/jdom-b6/build/jdom.jar:/usr/local/jdom-b6/lib/xerces.jar:/usr/local/jdom-b6:/usr/local/jakarta-log4j-1.0.4/classes:/home/thomasn/src:/usr/local/enhydra4.0/lib/servlet.jar
Any suggestions would be very welcome.
Thanks,
Thomas.
==== ParseTest.java ====
package test;
import org.dom4j.io.*;
import org.dom4j.*;
import org.dom4j.tree.*;
class ParseTest {
static public void main (String args[]) {
try {
if (args.length == 0) {
System.out.println ("Error: must specify XML file.");
}
else {
SAXReader reader = new SAXReader (false); // No
validation.
Document doc = reader.read (args[0]);
XMLWriter writer = new XMLWriter(System.out,
OutputFormat.createPrettyPrint());
writer.write (doc);
// System.out.println (doc.asXML());
}
}
catch (Exception e) {
System.out.println ("Exception: " + e.getMessage());
}
}
}
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-dev