Hi Ryan,
This looks like a limitation in the serializer. It serializes a DOM using
recursion, so I'm not surprised this might happen with a document with an
element depth of 10,000. I believe there's an option (at least with some
versions of Java) for adjusting the stack size used by the runtime. It
would probably one of the -X options. You might be able to workaround the
problem if you can increase the limit.
On Thu, 6 Nov 2003, 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
---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]