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...@locus.apache.org on 2000/12/06 00:31:13 UTC

cvs commit: xml-xalan/c/src/XMLSupport FormatterToText.cpp FormatterToText.hpp

dbertoni    00/12/05 15:31:12

  Modified:    c/src/XMLSupport FormatterToText.cpp FormatterToText.hpp
  Log:
  Fixed problem with handling ignorable whitespace.
  
  Revision  Changes    Path
  1.14      +14 -7     xml-xalan/c/src/XMLSupport/FormatterToText.cpp
  
  Index: FormatterToText.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToText.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- FormatterToText.cpp	2000/12/04 20:48:12	1.13
  +++ FormatterToText.cpp	2000/12/05 23:31:11	1.14
  @@ -74,13 +74,15 @@
   
   FormatterToText::FormatterToText(
   			Writer&		writer,
  -			bool		normalizeLinefeed) :
  +			bool		normalizeLinefeed,
  +			bool		handleIgnorableWhitespace) :
   	FormatterListener(OUTPUT_METHOD_TEXT),
   	m_writer(writer),
   	m_maxCharacter(XalanDOMChar(~0)),
   	m_encoding(),
   	m_haveEncoding(false),
  -	m_normalize(normalizeLinefeed)
  +	m_normalize(normalizeLinefeed),
  +	m_handleIgnorableWhitespace(handleIgnorableWhitespace)
   {
   }
   
  @@ -89,13 +91,15 @@
   FormatterToText::FormatterToText(
   			Writer&					writer,
   			const XalanDOMString&	encoding,
  -			bool					normalizeLinefeed) :
  +			bool					normalizeLinefeed,
  +			bool					handleIgnorableWhitespace) :
   	FormatterListener(OUTPUT_METHOD_TEXT),
   	m_writer(writer),
   	m_maxCharacter(0),
   	m_encoding(isEmpty(encoding) == false ? encoding : XalanDOMString(XalanTranscodingServices::s_utf8String)),
   	m_haveEncoding(true),
  -	m_normalize(normalizeLinefeed)
  +	m_normalize(normalizeLinefeed),
  +	m_handleIgnorableWhitespace(handleIgnorableWhitespace)
   {
   	XalanOutputStream* const	theStream = m_writer.getStream();
   
  @@ -233,10 +237,13 @@
   
   void
   FormatterToText::ignorableWhitespace(
  -			const XMLCh* const	/* chars */,
  -			const unsigned int	/* length */)
  +			const XMLCh* const	chars,
  +			const unsigned int	length)
   {
  -	// No action for the moment.
  +	if (m_handleIgnorableWhitespace == true)
  +	{
  +		characters(chars, length);
  +	}
   }
   
   
  
  
  
  1.8       +8 -2      xml-xalan/c/src/XMLSupport/FormatterToText.hpp
  
  Index: FormatterToText.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XMLSupport/FormatterToText.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FormatterToText.hpp	2000/11/20 16:18:53	1.7
  +++ FormatterToText.hpp	2000/12/05 23:31:11	1.8
  @@ -91,10 +91,12 @@
   	 *
   	 * @param writer writer for output
   	 * @param normalizeLindefeed Normalize \n or \r\n (on certain platforms).
  +	 * @param handleIgnorableWhitespace If true ignorableWhitespace() will write data to the Writer
   	 */
   	FormatterToText(
   			Writer&		writer,
  -			bool		normalizeLinefeed = true);
  +			bool		normalizeLinefeed = true,
  +			bool		handleIgnorableWhitespace = true);
   
   	/**
   	 * FormatterToText instance constructor.
  @@ -102,11 +104,13 @@
   	 * @param writer writer for output
   	 * @param encoding character encoding for the writer
   	 * @param normalizeLindefeed Normalize \n or \r\n on certain platforms.
  +	 * @param handleIgnorableWhitespace If true ignorableWhitespace() will write data to the Writer
   	 */
   	FormatterToText(
   			Writer&					writer,
   			const XalanDOMString&	encoding,
  -			bool					normalizeLinefeed = true);
  +			bool					normalizeLinefeed = true,
  +			bool					handleIgnorableWhitespace = false);
   
   	virtual
   	~FormatterToText();
  @@ -187,6 +191,8 @@
   	const bool		m_haveEncoding;
   
   	const bool		m_normalize;
  +
  +	const bool		m_handleIgnorableWhitespace;
   };