You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/12/09 23:25:27 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/serialize CharInfo.java FormatterToXML.java

sboag       00/12/09 14:25:27

  Modified:    java/src/org/apache/xalan/serialize CharInfo.java
                        FormatterToXML.java
  Log:
  Set the carriage return as special, and normalize the
  cr/lf in attributes, since the parser doesn't seem to
  do it.
  
  Revision  Changes    Path
  1.3       +4 -0      xml-xalan/java/src/org/apache/xalan/serialize/CharInfo.java
  
  Index: CharInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/serialize/CharInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CharInfo.java	2000/12/07 08:16:10	1.2
  +++ CharInfo.java	2000/12/09 22:25:27	1.3
  @@ -96,6 +96,9 @@
     /** The linefeed character, which the parser should always normalize. */
     public static char S_LINEFEED = 0x0A;
   
  +  /** The carriage return character, which the parser should always normalize. */
  +  public static char S_CARRIAGERETURN = 0x0D;
  +
     /**
      * Constructor that reads in a resource file that describes the mapping of
      * characters to entity references.
  @@ -169,6 +172,7 @@
   
         is.close();
         m_specialsMap.set(S_LINEFEED);
  +      m_specialsMap.set(S_CARRIAGERETURN);
       }
       catch (Exception except)
       {
  
  
  
  1.9       +11 -0     xml-xalan/java/src/org/apache/xalan/serialize/FormatterToXML.java
  
  Index: FormatterToXML.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/serialize/FormatterToXML.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FormatterToXML.java	2000/12/07 08:16:11	1.8
  +++ FormatterToXML.java	2000/12/09 22:25:27	1.9
  @@ -1949,9 +1949,20 @@
         char ch = stringChars[i];
   
         if ((ch < m_maxCharacter) && (!m_charInfo.isSpecial(ch)))
  +      {
           accum(ch);
  +      }
         else
  +      {
  +        // I guess the parser doesn't normalize cr/lf in attributes. -sb
  +        if((CharInfo.S_CARRIAGERETURN == ch) && ((i+1) < len) 
  +        && (CharInfo.S_LINEFEED == stringChars[i+1]))
  +        {
  +          i++;
  +          ch = CharInfo.S_LINEFEED;
  +        }
           accumDefaultEscape(ch, i, stringChars, len, true);
  +      }
       }
     }