Hi there,
    i'm trying to parse a large xml file with dom4j and SAXReader. My code 
works fine with small files but with the large ones (320 MB) I get a 
"OutOfMemory" exception (Exception in thread "main" java.lang.OutOfMemoryError 
it says). Is there any tip you can give me? I've tried to execute the code 
giving more memory to java (with the "-mx512MB option) but although it lasted 
for longer it finally failed. "Any help or advice would be great. Thanks in 
advance. Cheers,


Bittor.


PS: This is the snippet of my code where it failes:

InputStream input = Test.class.getClassLoader().getResourceAsStream(batchName); 
  // BatchName is the xml file I want to read
BufferedInputStream bufferedStream = new BufferedInputStream(input, 32*1024);

SAXReader reader = new SAXReader();
System.out.println("Parsing XML file - Start");
Document document = reader.read(bufferedStream);        // WITHOUT "-mx512M" it 
fails HERE
System.out.println("Parsing XML file - End");

pictureList = document.selectNodes( "//one/two/three" );        // WITH 
"-mx512M" it fails HERE


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to