dear all,
 
how do i preserve carriage returns inside attributes?
 
if i have some xml as a String,
 
<x a="hello
world"/>
 
then when i parse it and then serialize it like follows the carriage return is lost, and i end up with
 
<x a="hello world"/>
 
  org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
  InputSource is = new InputSource( new ByteArrayInputStream( s.getBytes()));
  parser.parse( is );
  Element n2 = parser.getDocument().getDocumentElement();
  OutputFormat of = new OutputFormat();
  of.setOmitXMLDeclaration( true );
  of.setIndenting( false );
  org.apache.xml.serialize.XMLSerializer ser = new XMLSerializer( System.out, of );
  ser.asDocumentHandler();
  ser.setOutputFormat( of );
  ser.serialize( n2 );
what do i need to do to keep the original format?
 
thanks,
greg.

Reply via email to