sboag 00/10/17 12:26:59
Modified: java/src/org/apache/xml/serialize/transition
BaseMarkupSerializer.java
Log:
Remove line break normalization. Ain't worth it.
Revision Changes Path
1.6 +43 -24
xml-xalan/java/src/org/apache/xml/serialize/transition/BaseMarkupSerializer.java
Index: BaseMarkupSerializer.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xml/serialize/transition/BaseMarkupSerializer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BaseMarkupSerializer.java 2000/10/13 21:06:40 1.5
+++ BaseMarkupSerializer.java 2000/10/17 19:26:58 1.6
@@ -138,7 +138,7 @@
* another element.
*
*
- * @version $Revision: 1.5 $ $Date: 2000/10/13 21:06:40 $
+ * @version $Revision: 1.6 $ $Date: 2000/10/17 19:26:58 $
* @author <a href="mailto:[EMAIL PROTECTED]">Assaf Arkin</a>
* @see Serializer
* @see DOMSerializer
@@ -412,7 +412,9 @@
try
{
if ( _format.getEncoding() == null )
+ {
_writer = new OutputStreamWriter( _output );
+ }
else
_writer = Encodings.getWriter( _output, _format.getEncoding()
);
}
@@ -1275,18 +1277,29 @@
char ch;
if ( preserveSpace ) {
- // Preserving spaces: the text must print exactly as it is,
- // without breaking when spaces appear in the text and without
- // consolidating spaces. If a line terminator is used, a line
- // break will occur.
+ // Preserving spaces: the text must print exactly as it is,
+ // without breaking when spaces appear in the text and without
+ // consolidating spaces. If a line terminator is used, a line
+ // break will occur.
+ if(unescaped)
+ {
while ( length-- > 0 ) {
- ch = chars[ start ];
- ++start;
- if ( ch == '\n' || ch == '\r' || unescaped )
- _printer.printText( ch );
- else
- printEscaped( ch );
+ ch = chars[ start ];
+ ++start;
+ _printer.printText( ch );
+ }
+ }
+ else
+ {
+ while ( length-- > 0 ) {
+ ch = chars[ start ];
+ ++start;
+ if ( ch == '\n' || ch == '\r' )
+ _printer.printText( ch );
+ else
+ printEscaped( ch );
}
+ }
} else {
// Not preserving spaces: print one part at a time, and
// use spaces between parts to break them into different
@@ -1296,10 +1309,11 @@
while ( length-- > 0 ) {
ch = chars[ start ];
++start;
- if ( ch == ' ' || ch == '\f' || ch == '\t' || ch == '\n' ||
ch == '\r' )
- _printer.printSpace();
- else if ( unescaped )
- _printer.printText( ch );
+ // if ( ch == ' ' || ch == '\f' || ch == '\t' || ch == '\n'
|| ch == '\r' )
+ // _printer.printSpace();
+ // else
+ if ( unescaped )
+ _printer.printText( ch );
else
printEscaped( ch );
}
@@ -1331,13 +1345,14 @@
// by printing mechanism. Line terminator is treated
// no different than other text part.
for ( index = 0 ; index < text.length() ; ++index ) {
- ch = text.charAt( index );
- if ( ch == ' ' || ch == '\f' || ch == '\t' || ch == '\n' ||
ch == '\r' )
- _printer.printSpace();
- else if ( unescaped )
- _printer.printText( ch );
- else
- printEscaped( ch );
+ ch = text.charAt( index );
+ // if ( ch == ' ' || ch == '\f' || ch == '\t' || ch == '\n' ||
ch == '\r' )
+ // _printer.printSpace();
+ // else
+ if ( unescaped )
+ _printer.printText( ch );
+ else
+ printEscaped( ch );
}
}
}
@@ -1402,8 +1417,12 @@
*/
protected void printEscaped( String source )
{
- for ( int i = 0 ; i < source.length() ; ++i )
- printEscaped( source.charAt( i ) );
+ int n = source.length();
+ for ( int i = 0 ; i < n ; ++i )
+ {
+ char c = source.charAt( i );
+ printEscaped( c );
+ }
}