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
 

Reply via email to