santiagopg    2002/06/24 13:09:43

  Modified:    java/src/org/apache/xalan/xsltc/runtime/output
                        StreamHTMLOutput.java StreamOutput.java
                        StreamXMLOutput.java
  Log:
  Fix for Bugzilla 6925.
  
  Revision  Changes    Path
  1.14      +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamHTMLOutput.java
  
  Index: StreamHTMLOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamHTMLOutput.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StreamHTMLOutput.java     19 Jun 2002 20:36:05 -0000      1.13
  +++ StreamHTMLOutput.java     24 Jun 2002 20:09:43 -0000      1.14
  @@ -260,7 +260,7 @@
        if (_startTagOpen) {
            closeStartTag();
        }
  -     _buffer.append("<!--").append(comment).append("-->");
  +     appendComment(comment);
       }
   
       public void processingInstruction(String target, String data)
  
  
  
  1.16      +30 -1     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamOutput.java
  
  Index: StreamOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamOutput.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StreamOutput.java 19 Jun 2002 19:24:49 -0000      1.15
  +++ StreamOutput.java 24 Jun 2002 20:09:43 -0000      1.16
  @@ -307,4 +307,33 @@
        _buffer.append('>');
        _startTagOpen = false;
       }
  +
  +    /**
  +     * Ensure that comments do not include the sequence "--" and
  +     * that they do not end with "-".
  +     */
  +    protected void appendComment(String comment) 
  +     throws TransletException 
  +    {
  +     boolean lastIsDash = false;
  +     final int n = comment.length();
  +
  +     _buffer.append("<!--");
  +     for (int i = 0; i < n; i++) {
  +         final char ch = comment.charAt(i);
  +         final boolean isDash = (ch == '-');
  +
  +         if (lastIsDash && isDash) {
  +             _buffer.append(" -");
  +         }
  +         else {
  +             _buffer.append(ch);
  +         }
  +         lastIsDash = isDash;
  +     }
  +     if (lastIsDash) {
  +         _buffer.append(' ');
  +     }
  +     _buffer.append("-->");
  +    }
   }
  
  
  
  1.16      +2 -3      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamXMLOutput.java
  
  Index: StreamXMLOutput.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/output/StreamXMLOutput.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StreamXMLOutput.java      19 Jun 2002 15:33:32 -0000      1.15
  +++ StreamXMLOutput.java      24 Jun 2002 20:09:43 -0000      1.16
  @@ -250,8 +250,7 @@
        else if (_cdataTagOpen) {
            closeCDATA();
        }
  -
  -     _buffer.append("<!--").append(comment).append("-->");
  +     appendComment(comment);
       }
   
       public void processingInstruction(String target, String data)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to