If you specify a grammar that allows the parser to determine whether whitespace in element content should be preserved, tell the parser to validate, and setIncludeIgnorableWhitespace(false), you can ensure that ignorable whitespace is not included in your DOM.
There are caveats, however. See http://xml.apache.org/xerces-c/apiDocs/classAbstractDOMParser.html#z852_ 4. Furthermore, stripping whitespace when parsing is risky business; what if the document author wanted exactly two blank lines just there? If the parser discards them, you can't get them back. As for the bugness of this issue: I think it's a gray area. On the one hand, pretty-printing is optional and essentially undefined; as long as the output is valid, anything goes. On the other hand, there are at least two people who would rather DOMWriter didn't insert blank lines. Here's what I'd suggest: try hacking it up as I suggested. If you like the results, file a bug, and one of us can attach a patch. Further discussion can be part of the bug for posterity. -----Original Message----- From: T MacAdam [mailto:[EMAIL PROTECTED] Sent: Thursday, August 05, 2004 11:08 AM To: [EMAIL PROTECTED] Subject: RE: Still no luck with blank lines around CDATA sections (easily repeatable!) Thanks, I will try as you suggest. It will likely fix it for my purposes. I am inclined to think it is still a bug for others, however, for the simple reason that the blank lines accumulate as I described. That's the real problem to me; I wouldn't mind if the pretty printer put a couple blank lines around CDATAs, it's just that each time the file is read/saved, it keeps adding more. If you save a file a dozen times, you get quite large regions of blank lines, which I can't imagine is the intent? Actually, I just had a brainwave, maybe the problem is actually on the input rather than the output, then. Perhaps blank lines are not being properly stripped out on input, then more lines are simply added on output? Tom. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]