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 17:37:56 UTC

DO NOT REPLY [Bug 21712] - 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





------- Additional Comments From sander@x-hive.com  2003-07-18 15:37 -------
To add to my own report, it turns out what I did does not always work. For some 
reason with ignorableWhiteSpace overridden as I did I now got XML files with 
the <?xml...?> declaration only on the fourth line with whitespace before it 
for some parser pipelines (meaning non-wellformed xml output).

So I now went to the following overriding method combo, which seems to work 
better:
  public void startElement(String s, String s1, String s2, Attributes 
attributes) throws SAXException {
    this.inDocument = true;
    super.startElement(s, s1, s2, attributes);
  }

  public void endDocument() throws SAXException {
    super.endDocument();
    this.inDocument = false;
  }

  public void ignorableWhitespace(char[] chars, int i, int i1) throws 
SAXException {
    this._indenting = this.inDocument;
    try {
      super.ignorableWhitespace(chars, i, i1);
    } finally {
      this._indenting = false;
    }
  }

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