Look to me that you run out of memory.
If you really need to serialize all data in the world into memory array, use java command line parameter to set maximum heap size (java -Xmx128M).

Michael Ryan Bannon wrote:
Hello,
 
Forgive me if this has been mentioned before in another thread...
 
I am running into a StackOverflowError when attempting to serialize a large XML document (10000+ nodes, with a height of 10000).
I have the following method:
 
 private static String serialize(Document doc) {
 
*****************************************
  try {
   // Set the output format.
   OutputFormat format = new OutputFormat();
   format.setIndent(5);
 
   // Serialize the document.
   Serializer serializer = new XMLSerializer(format);
   ByteArrayOutputStream outStream = new ByteArrayOutputStream();
   serializer.setOutputByteStream(outStream);
   DOMSerializer domSerializer = serializer.asDOMSerializer();
   domSerializer.serialize(doc);
   return outStream.toString();
 
  } catch (IOException e) {
   System.out.println(e);
  }
  return null;
 }
*****************************************
 
The line "domSerializer.serialize(doc);" is causing a StackOverflowError.
Is there a solution to this?
 
Any help is greatly appreciated.
 
Thanks,
 
Ryan
 

--

Maksym Kovalenko
Software Engineer
Marketswitch Corporation
http://www.marketswitch.com
108 Powers Court, Suite 225
Dulles, VA 20166
Phone: +1 (703) 444-6750 ext. 302
Fax: +1 (703) 444-6812

Reply via email to