You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Troy Holly <tr...@directbox.de> on 2003/05/05 16:49:13 UTC

[Vers 1.4] XMLSerializer without a DTD

 Instances of XMLSerializer with  format.setPreserveSpace(false) are outputing spaces, which may be a bug. Heres my input file (dots are spaces):

<TELEGRAM>
...<PAKID>4711</PAKID>
</TELEGRAM>
 
Here is my code:

Document doc = parser.parse("myfile.xml");
OutputFormat format  = new OutputFormat( doc );
format.setPreserveSpace(false);
stringOut = new StringWriter();
XMLSerializer serial = new XMLSerializer( stringOut, format );
serial.setOutputCharStream(stringOut);
serial.serialize( doc.getDocumentElement() );
System.out.println( stringOut );

And here is the output:

<TELEGRAM>....<PAKID>4711</PAKID>.</TELEGRAM>

Is this a bug? If I add a DTD, then the output is as expected:

<TELEGRAM><PAKID>4711</PAKID></TELEGRAM>

Thanks
Troy Holly




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