I don't know what could be causing extra newlines, but if you read in a document with whitespace, you'll write out a document with whitespace unless you strip it out. You can have a validating parser do this for you by providing a DTD or Schema for your documents and calling setIncludeIgnorableWhitespace(false) on the parser before reading the document. Call setValidationScheme(Val_Always) to ensure the parser always validates, or use Val_Auto if validation is optional.
-----Original Message----- From: Kelly Beard [mailto:[email protected]] Sent: Tuesday, March 10, 2009 12:05 PM To: [email protected] Subject: DOMWriter help I can't seem to be able to force a DOMWriter to write XML in a flat way. By flat I mean that all elements are on a single line, no pretty print, etc. If I create a document in memory I can write it out flat, but let's say you read in a document from a file that was created with some sort of formatting. If you read in this document and write it out, you always get a pretty-print output, sometimes with extra newlines, even if you have all that pretty-printing shut off. Anyone know how to do this? I didn't think that the document was being held in memory like this, with all of the formatting and such. -- Kelly Beard
