You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Ravi Kollu <rk...@cyberelan.com> on 2001/03/21 22:29:32 UTC

Question about org.apache.xml.serialize.XMLSerializer

When I am serializing an XML document with the following OutputFormat, the new lines in attributes and comments are being replaced with a white space. Does anyone know if this is a bug or should I be setting some other option to preserve the newlines.

OutputFormat ofXML = new OutputFormat( document );
ofXML.setIndenting(false) ;
ofXML.setPreserveSpace(true) ;

- Ravi

Re: Question about org.apache.xml.serialize.XMLSerializer

Posted by arkin <ar...@intalio.com>.
New lines in attributes is per the XML specification. The parser will do
the same when it reads the document in. Attributes values are subject to
some normalization rules, see the XML specification.

New lines in comments is the fault of the serializer, which applies its
own reformatting rules. Shouldn't be hard to change by making comments
serialize as whitespace preserving.

arkin

Ravi Kollu wrote:
> 
> > > Ravi Kollu wrote:
> > >
> > > When I am serializing an XML document with the following OutputFormat,
> the new lines in attributes and comments are being replaced with a white
> space. Does anyone know if this is a bug or should I be setting some other
> option to preserve the newlines.
> >
> > You will never preserve such information with DOM implementation
> independent
> > serializer (such as serialie package) since DOM does not contain it.
> >
> 
> I forgot to mention that I am using xerces 1.3.0 DOM implementation and
> org.apache.xml.serialize.XMLSerializer class for serialization.
> 
> - Ravi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

-- 
----------------------------------------------------------------------
Assaf Arkin                                          arkin@intalio.com
CTO,  Intalio Inc.                                     www.intalio.com
The Business Process Management Company                 (650) 345 2777

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Question about org.apache.xml.serialize.XMLSerializer

Posted by Ravi Kollu <rk...@cyberelan.com>.
> > Ravi Kollu wrote:
> >
> > When I am serializing an XML document with the following OutputFormat,
the new lines in attributes and comments are being replaced with a white
space. Does anyone know if this is a bug or should I be setting some other
option to preserve the newlines.
>
> You will never preserve such information with DOM implementation
independent
> serializer (such as serialie package) since DOM does not contain it.
>

I forgot to mention that I am using xerces 1.3.0 DOM implementation and
org.apache.xml.serialize.XMLSerializer class for serialization.

- Ravi


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Question about org.apache.xml.serialize.XMLSerializer

Posted by Petr Kuzel <Pe...@sun.com>.
> Ravi Kollu wrote:
> 
> When I am serializing an XML document with the following OutputFormat, the new lines in attributes and comments are being replaced with a white space. Does anyone know if this is a bug or should I be setting some other option to preserve the newlines.

You will never preserve such information with DOM implementation independent 
serializer (such as serialie package) since DOM does not contain it.

  Cc.

-- 
<address>
<a href="mailto:pkuzel@netbeans.com">Petr Kuzel</a>, Sun Microsystems
: <a href="http://www.sun.com/forte/ffj/ie/">Forte Tools</a>
: XML and <a href="http://jini.netbeans.org/">Jini</a> modules</address>

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org