|
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.
|
- NullPointerException trying to parse a simple XML file. Greg Matthews
- NullPointerException trying to parse a simple XML file. Brad O'Hearne
- RE: NullPointerException trying to parse a simple X... Brad O'Hearne
- Re: NullPointerException trying to parse a simple X... Elena Litani
- Windows Paths Brad O'Hearne
- Re: Windows Paths Milind Gadre
- RE: Windows Paths Brad O'Hearne
- RE: carriage return in attribute not preserved Sam Pullara
- Re: carriage return in attribute not preserved Tom Bradford
- Re: carriage return in attribute not preserved Greg Matthews
