Hi Richa,

richa <[EMAIL PROTECTED]> wrote on 07/30/2007 09:33:07 AM:

> Hi Michael
> Thanx for the help.
> However, i'm still not able to get the desired output. How can we set
> version and indention?

"format-pretty-print" [1] controls whether the LSSerializer adds 
indentation.

> right now i'm able to generate the xml file but it is coming without any
> format. 
> and still the memory utilization is 21%. 
> to get it written at a a particular file i'm using 
> String source = writer.writeToString(xmlDoc); // this function is taking 
21%
> of runtime memory
> and then i count string in byte array and get it written to a specific
> location.
>
> Any suggestions.. how can i do in a better way?

Asking the serializer to produce a string which you immediately write to a 
file is a waste of time and memory. If you want to write the document to a 
file, you should write it directly to a file. See LSOutput.setByteStream() 
[2].

> Thank You
> Regards
> Richa

Thanks.

[1] 
http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#parameter-format-pretty-print
[2] 
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSOutput.html#setByteStream(java.io.OutputStream)

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]

Reply via email to