Hi Michael
Thanx again for the help.
However, there is one more problem . when i'm setting the value for
"format-pretty-print" as true, i"m getting an exception
FEATURE_NOT_SUPPORTED. the parameter format-pretty-print is recognized but
the requested value cannot be supported.
The code i'm using is :
DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance();
DOMImplementationLS impl =
(DOMImplementationLS)registry.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
DOMConfiguration dmconfig = writer.getDomConfig();
dmconfig.setParameter("format-pretty-print", true);
what should i do now??
Thank You
Regards
Richa
Michael Glavassevich wrote:
>
> Hi Richa,
>
> richa <richa.sud@xxxxxxxxxxxxxx> 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: mrglavas@xxxxxxxxxx
> E-mail: mrglavas@xxxxxxxxxx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
>
>
>
--
View this message in context:
http://www.nabble.com/optimise-XmlSerialise.serialise%28Document-doc%29-tf4156014.html#a11921984
Sent from the Xerces - J - Users mailing list archive at Nabble.com.
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|