Which version of Java are you using ? "format-pretty-print" is a DOM
Level 3 feature.

This means that if you are using JDK < version 5 (or even JDK 5, not
sure), you will need to use endored.dirs overrides mechanism to pick up
the xerces 9 implementation. Putting xerces 9 jars in classpath is not
enough.

http://java.sun.com/j2se/1.4.2/docs/guide/standards/

Hope this helps
-Prashant

On Tue, 2007-07-31 at 03:54 -0700, richa wrote:
> 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 <[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]
> > 
> > 
> > 
> 
-- 

-Prashant

Don't upload, just share : www.dekoh.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to