You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2004/01/22 03:44:45 UTC

cvs commit: xml-xalan/c/src/xalanc/XMLSupport FormatterToXML.cpp FormatterToHTML.cpp

dbertoni    2004/01/21 18:44:45

  Modified:    c/src/xalanc/XMLSupport FormatterToXML.cpp
                        FormatterToHTML.cpp
  Log:
  Make sure we write an XML header if the output encoding is not utf-8 or utf-16.
  
  Revision  Changes    Path
  1.8       +14 -3     xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML.cpp
  
  Index: FormatterToXML.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXML.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FormatterToXML.cpp	9 Jan 2004 07:07:46 -0000	1.7
  +++ FormatterToXML.cpp	22 Jan 2004 02:44:45 -0000	1.8
  @@ -194,9 +194,20 @@
   
   	m_maxCharacter = XalanTranscodingServices::getMaximumCharacterValue(m_encoding);
   
  -	m_encodingIsUTF = XalanTranscodingServices::encodingIsUTF8(m_encoding) ||
  -					  XalanTranscodingServices::encodingIsUTF16(m_encoding) ||
  -					  XalanTranscodingServices::encodingIsUTF32(m_encoding);
  +    // We cannot omit the XML declaration if the encoding is not UTF-8 or
  +    // UTF-16
  +    const bool  canOmitXMLDeclaration =
  +        XalanTranscodingServices::encodingIsUTF8(m_encoding) ||
  +		XalanTranscodingServices::encodingIsUTF16(m_encoding);
  +
  +    if (canOmitXMLDeclaration == false && m_shouldWriteXMLHeader == false)
  +    {
  +        m_shouldWriteXMLHeader = true;
  +    }
  +
  +    //OK, now we can determine if the encoding is UTF*
  +	m_encodingIsUTF = canOmitXMLDeclaration || XalanTranscodingServices::encodingIsUTF32(m_encoding);
  +
   
   #if 1
   	if (m_encodingIsUTF == true)
  
  
  
  1.5       +4 -0      xml-xalan/c/src/xalanc/XMLSupport/FormatterToHTML.cpp
  
  Index: FormatterToHTML.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToHTML.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FormatterToHTML.cpp	6 Jan 2004 02:41:31 -0000	1.4
  +++ FormatterToHTML.cpp	22 Jan 2004 02:44:45 -0000	1.5
  @@ -135,6 +135,10 @@
   	m_elementPropertiesStack()
   {
   	initCharsMap();
  +
  +    // FormatterToXML may have enabled this property, based on
  +    // the encoding, so we should force it off.
  +    m_shouldWriteXMLHeader = false;
   }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org