Hi Nicolas,
Nicolas HERNANDEZ wrote:
> Hi Jörg,
>
> The spaces are preserved when I serialize using toXML method. When I check
> with an editor I see the original indentation.
>
> But when I use the following method xstream.fromXML(myXMLString) to
> deserialize,
> all the newlines and tabs characters are replaced by simple whitespaces
> characters.
>
> Is it more clear ?
No.
============ %< ==============
XStream xstream = new XStream();
String orig = " abc\n def\n\t\t";
String xml = xstream.toXML(orig);
System.out.println(xml);
if(orig.equals(xstream.fromXML(xml)))
System.out.println("XML is equal!");
============ %< ==============
The code above will print
============ %< ==============
<string> abc
def
</string>
XML is equal!
============ %< ==============
The string has been marshalled into XML and unmarshalled again and its still
equal.
Cheers,
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email