ilene 2002/09/20 11:53:18
Modified: java/src/org/apache/xalan/serialize SerializerToXML.java
Log:
Committing Gordon Chiu's ([EMAIL PROTECTED]) patch for bugzilla #6927.
Revision Changes Path
1.17 +19 -1
xml-xalan/java/src/org/apache/xalan/serialize/SerializerToXML.java
Index: SerializerToXML.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/serialize/SerializerToXML.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SerializerToXML.java 21 Jun 2002 18:54:33 -0000 1.16
+++ SerializerToXML.java 20 Sep 2002 18:53:18 -0000 1.17
@@ -1278,8 +1278,26 @@
try
{
final Writer writer = m_writer;
+ final int limit = start + length;
+ boolean wasDash = false;
writer.write("<!--");
- writer.write(ch, start, length);
+
+ // Detect occurrences of two consecutive dashes, handle as necessary.
+ for (int i = start; i < limit; i++) {
+ if (wasDash && ch[i] == '-') {
+ writer.write(ch, start, i - start);
+ writer.write(" -");
+ start = i + 1;
+ }
+ wasDash = (ch[i] == '-');
+ }
+
+ // Output the remaining characters.
+ writer.write(ch, start, limit - start);
+ // Protect comment end from a single trailing dash
+ if (ch[limit-1] == '-')
+ writer.write(' ');
+
writer.write("-->");
}
catch(IOException ioe)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]