You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2003/07/18 16:38:34 UTC
DO NOT REPLY [Bug 21712] New: -
XMLSerializer misses ignorableWhiteSpace when not indenting
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21712>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21712
XMLSerializer misses ignorableWhiteSpace when not indenting
Summary: XMLSerializer misses ignorableWhiteSpace when not
indenting
Product: Xerces2-J
Version: 2.4.0
Platform: All
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: Serialization
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: sander@x-hive.com
We use org.apache.xml.serialize.XMLSerializer in 'xni-mode', so as a document
handler. What we strive for is correct roundtrip in parsing+serializing, so we
don't have indenting on. However, we would like all whitespace that was in the
original file back.
However, in BaseMarkupSerializer::ignorableWhitespace, the whitespace will only
be added if indenting mode is on, so whitespace between element-borders is
filtered out when parsing with validation. I don't think that is correct.
I now extended XML Serializer with overrided
public void ignorableWhitespace(char[] chars, int i, int i1) throws
SAXException {
this._indenting = true;
try {
super.ignorableWhitespace(chars, i, i1);
} finally {
this._indenting = false;
}
}
Then the roundtrip on parse (with validation on) plus serialize is perfect, all
the whitespace is back.
Should ignorableWhitespace not always put the whitespace in, regardless of
whether indenting is on or off?
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org