Felix,

In the code snippet you're creating and configuring an OutputFormat and
then passing a new and entirely different instance of OutputFormat to the
XMLSerializer. If this is what you're really doing it's not surprising that
none of your settings take effect. Also, if this is a new application that
you're writing I would encourage you to avoid using XMLSerializer. We
deprecated this API [1] in Xerces-J 2.9.0. It's better to use standard APIs
such as DOM Level 3 or the JAXP Transform API for DOM serialization.

Thanks.

[1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

jfs <[EMAIL PROTECTED]> wrote on 11/16/2008 11:14:10 AM:

> Hi,
>
> I want to serialize a Document object to XML using the following code:
>
> [...]
>    OutputFormat format = new OutputFormat(xhtmlDoc);
>    format.setIndenting(true);
>    format.setPreserveSpace(true);
>    format.setLineSeparator(System.getProperty("line.separator"));
>    format.setMethod("text/xhtml");
>
>    XMLSerializer serial = new XMLSerializer(new
> BufferedWriter(res.getWriter()), new OutputFormat());
>    DOMSerializer domserial = serial.asDOMSerializer();
>    domserial.serialize(xhtmlDoc);
> [...]
>
> res is a HttpServletResponse object. The serialized XML is submitted to
the
> client and should be pretty printed. What I get is the complete serialize
> output on a single line.
>
> What do I have to do?
>
> Thanks!
> -Felix
> --
> View this message in context: http://www.nabble.com/No-newlines-in-
> DOM-serialization-tp20526791p20526791.html
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to