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/08/15 15:30:13 UTC

DO NOT REPLY [Bug 21404] - Serialization of tags with long text inserts line break and indentation!

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=21404>.
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=21404

Serialization of tags with long text inserts line break and indentation!





------- Additional Comments From gordongano99@yahoo.com  2003-08-15 13:30 -------
This is the behavior that happens when you call setIndenting(true) and leave 
setPreserveSpace() as false. (According to bug 9793 you shouldn't have them 
both set to true.) The result leaves your text content mangled. 

This is a pretty ugly problem - if you want your XML to be pretty-printed, then 
your text content will get mangled.

I was able to work around this problem by extending XMLSerializer add adding 
these overrides, so that printText() was never called with preserveSpace equals 
false.

	protected void printText( String text, boolean preserveSpace, boolean 
unescaped ) throws IOException
	{
        // set preserveSpace to true, no matter what we were called with.
		super.printText( text, true, unescaped );
	}
			
	protected void printText( char[] chars, int start, int length, boolean 
preserveSpace, boolean unescaped ) throws IOException 
	{
        // set preserveSpace to true, no matter what we were called with.
		super.printText( chars, start, length, true, unescaped );
	}

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