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 2005/10/08 00:45:46 UTC
cvs commit: xml-xalan/c/src/xalanc/XMLSupport FormatterToXMLUnicode.hpp XalanFormatterWriter.hpp XalanOtherEncodingWriter.hpp XalanUTF16Writer.hpp XalanUTF8Writer.hpp XalanXMLSerializerBase.hpp XalanXMLSerializerFactory.cpp
dbertoni 2005/10/07 15:45:46
Modified: c/src/xalanc/XMLSupport FormatterToXMLUnicode.hpp
XalanFormatterWriter.hpp
XalanOtherEncodingWriter.hpp XalanUTF16Writer.hpp
XalanUTF8Writer.hpp XalanXMLSerializerBase.hpp
XalanXMLSerializerFactory.cpp
Log:
Fixes for XALANC-552.
Revision Changes Path
1.8 +59 -43 xml-xalan/c/src/xalanc/XMLSupport/FormatterToXMLUnicode.hpp
Index: FormatterToXMLUnicode.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/FormatterToXMLUnicode.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FormatterToXMLUnicode.hpp 4 Aug 2005 18:01:40 -0000 1.7
+++ FormatterToXMLUnicode.hpp 7 Oct 2005 22:45:46 -0000 1.8
@@ -58,7 +58,7 @@
typedef typename UnicodeWriter::value_type value_type;
- enum eDummy
+ enum
{
eDefaultIndentAmount = 0
};
@@ -330,6 +330,11 @@
m_writer.write(
m_constants.s_xmlHeaderEndString,
m_constants.s_xmlHeaderEndStringLength);
+
+ if (getNeedToOutputDoctypeDecl() == false)
+ {
+ m_indentHandler.outputLineSep();
+ }
}
@@ -475,11 +480,16 @@
m_constants.s_cdataOpenString,
m_constants.s_cdataOpenStringLength);
- writeCDATAChars(chars, length);
+ bool outsideCDATA = false;
+
+ writeCDATAChars(chars, length, outsideCDATA);
- m_writer.write(
- m_constants.s_cdataCloseString,
- m_constants.s_cdataCloseStringLength);
+ if (outsideCDATA == false)
+ {
+ m_writer.write(
+ m_constants.s_cdataCloseString,
+ m_constants.s_cdataCloseStringLength);
+ }
}
/**
@@ -509,10 +519,10 @@
{
if(m_charPredicate.isForbidden(ch) == true)
{
- XalanXMLSerializerBase::throwInvalidXMLCharacterException(
- ch,
- m_version,
- getMemoryManager());
+ throwInvalidXMLCharacterException(
+ ch,
+ m_version,
+ getMemoryManager());
}
else
{
@@ -534,10 +544,10 @@
{
if(m_charPredicate.isForbidden(ch) == true)
{
- XalanXMLSerializerBase::throwInvalidXMLCharacterException(
- ch,
- m_version,
- getMemoryManager());
+ throwInvalidXMLCharacterException(
+ ch,
+ m_version,
+ getMemoryManager());
}
else
{
@@ -619,7 +629,6 @@
m_indentHandler.setPrevText(false);
m_indentHandler.push_preserve();
-
}
}
@@ -644,10 +653,11 @@
{
if(m_charPredicate.isCharRefForbidden(ch))
{
- XalanXMLSerializerBase::throwInvalidXMLCharacterException(
- ch,
- m_version,
- getMemoryManager()); }
+ throwInvalidXMLCharacterException(
+ ch,
+ m_version,
+ getMemoryManager());
+ }
else
{
start = m_writer.write( chars, start, length);
@@ -703,15 +713,11 @@
void
writeCDATAChars(
const XalanDOMChar chars[],
- XalanDOMString::size_type length)
+ XalanDOMString::size_type length,
+ bool& outsideCDATA)
{
XalanDOMString::size_type i = 0;
- // enum for a cheezy little state machine.
- enum eState { eNormalState = 0, eOutOfCDATA = 1};
-
- eState theCurrentState = eNormalState;
-
while(i < length)
{
// If "]]>", which would close the CDATA appears in
@@ -721,10 +727,18 @@
const XalanDOMChar theChar = chars[i];
- if ( theChar == XalanUnicode::charRightSquareBracket &&
- XalanUnicode::charRightSquareBracket == chars[i+1] &&
- XalanUnicode::charGreaterThanSign == chars[i+2])
+ if (theChar == XalanUnicode::charRightSquareBracket &&
+ i - length > 2 &&
+ XalanUnicode::charRightSquareBracket == chars[i + 1] &&
+ XalanUnicode::charGreaterThanSign == chars[i + 2])
{
+ if (outsideCDATA == true)
+ {
+ m_writer.write(
+ m_constants.s_cdataCloseString,
+ m_constants.s_cdataCloseStringLength);
+ }
+
m_writer.write(value_type(XalanUnicode::charRightSquareBracket));
m_writer.write(value_type(XalanUnicode::charRightSquareBracket));
@@ -738,6 +752,8 @@
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
+ outsideCDATA = false;
+
i += 2;
}
else
@@ -746,27 +762,27 @@
{
outputNewline();
}
- if(m_charPredicate.isCharRefForbidden(theChar))
+ else if(m_charPredicate.isCharRefForbidden(theChar))
{
- XalanXMLSerializerBase::throwInvalidXMLCharacterException(
- theChar,
- m_version,
- getMemoryManager()); }
+ throwInvalidXMLCharacterException(
+ theChar,
+ m_version,
+ getMemoryManager());
+ }
else
{
- i = m_writer.writeCDATAChar(chars, i, length, (int&)theCurrentState);
+ i = m_writer.writeCDATAChar(chars, i, length, outsideCDATA);
}
-
}
++i;
}
- if( eOutOfCDATA == theCurrentState)
+ if(outsideCDATA == true)
{
- m_writer.write(
- m_constants.s_cdataOpenString,
- m_constants.s_cdataOpenStringLength);
+ m_writer.write(
+ m_constants.s_cdataOpenString,
+ m_constants.s_cdataOpenStringLength);
}
}
@@ -890,15 +906,15 @@
// Data members...
- XalanDOMString m_stringBuffer;
+ XalanDOMString m_stringBuffer;
- UnicodeWriter m_writer;
+ UnicodeWriter m_writer;
- ConstantsType m_constants;
+ ConstantsType m_constants;
- CharPredicate m_charPredicate;
+ CharPredicate m_charPredicate;
- IndentHandler m_indentHandler;
+ IndentHandler m_indentHandler;
};
1.7 +40 -10 xml-xalan/c/src/xalanc/XMLSupport/XalanFormatterWriter.hpp
Index: XalanFormatterWriter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XalanFormatterWriter.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanFormatterWriter.hpp 4 Aug 2005 18:01:40 -0000 1.6
+++ XalanFormatterWriter.hpp 7 Oct 2005 22:45:46 -0000 1.7
@@ -46,7 +46,8 @@
class NewLineWriterFunctor
{
public:
- typedef WriterType writer_type;
+
+ typedef WriterType writer_type;
NewLineWriterFunctor(WriterType& writer) :
m_writer(writer),
@@ -78,7 +79,8 @@
}
private:
- WriterType& m_writer;
+
+ WriterType& m_writer;
/**
* The string of characters that represents the newline
@@ -112,7 +114,9 @@
m_writer.write(value_type(XalanUnicode::charSpace));
}
}
+
private:
+
WriterType& m_writer;
};
@@ -123,7 +127,7 @@
CommonRepresentableCharFunctor(const XalanOutputStream* stream) :
m_stream(stream)
{
- assert( stream != 0 );
+ assert(stream != 0);
}
bool
@@ -139,18 +143,22 @@
return result;
}
-
private:
- const XalanOutputStream* m_stream;
+
+ const XalanOutputStream* const m_stream;
};
public:
-
+
+ typedef XalanDOMString::size_type size_type;
+
+
XalanFormatterWriter(
Writer& theWriter,
MemoryManager& theMemoryManager) :
m_writer(theWriter),
- m_memoryManager(theMemoryManager)
+ m_memoryManager(theMemoryManager),
+ m_stringBuffer(5, 0, theMemoryManager)
{
const XalanOutputStream* const theStream =
theWriter.getStream();
@@ -255,9 +263,9 @@
static void
throwInvalidUTF16SurrogateException(
- XalanDOMChar ch,
- XalanDOMChar next,
- MemoryManagerType& theManager)
+ XalanDOMChar ch,
+ XalanDOMChar next,
+ MemoryManagerType& theManager)
{
XalanDOMString chStr(theManager);
@@ -295,6 +303,8 @@
*/
MemoryManager& m_memoryManager;
+ XalanDOMString m_stringBuffer;
+
/**
* The string of characters that represents the newline
*/
@@ -305,6 +315,26 @@
*/
XalanDOMString::size_type m_newlineStringLength;
+ /**
+ * Format a code point as a numeric character reference.
+ *
+ * @param theChar A Unicode code point.
+ */
+ const XalanDOMString&
+ formatNumericCharacterReference(unsigned int theNumber)
+ {
+ clear(m_stringBuffer);
+
+ m_stringBuffer.push_back(XalanDOMChar(XalanUnicode::charAmpersand));
+ m_stringBuffer.push_back(XalanDOMChar(XalanUnicode::charNumberSign));
+
+ UnsignedLongToDOMString(theNumber, m_stringBuffer);
+
+ m_stringBuffer.push_back(XalanDOMChar(XalanUnicode::charSemicolon));
+
+ return m_stringBuffer;
+ }
+
private:
// These are not implemented.
1.3 +129 -182 xml-xalan/c/src/xalanc/XMLSupport/XalanOtherEncodingWriter.hpp
Index: XalanOtherEncodingWriter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XalanOtherEncodingWriter.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XalanOtherEncodingWriter.hpp 6 Jun 2005 18:01:19 -0000 1.2
+++ XalanOtherEncodingWriter.hpp 7 Oct 2005 22:45:46 -0000 1.3
@@ -26,89 +26,59 @@
-template <class PresentableCharacterPredicat,
+template <class Predicate,
class ConstantsType>
class XalanOtherEncodingWriter : public XalanFormatterWriter
{
- typedef XalanOtherEncodingWriter<PresentableCharacterPredicat, ConstantsType> ThisType;
+public:
+
+ typedef XalanOtherEncodingWriter<Predicate, ConstantsType> ThisType;
class WriteCharRef
{
public:
- WriteCharRef(ThisType& writer) :
- m_wasCalled(false),
- m_writer(writer),
- m_stringBuffer(5, 0, m_writer.getMemoryManager())
- {
- }
- void
- operator()(unsigned int value)
+ WriteCharRef(ThisType& writer) :
+ m_writer(writer)
{
- m_wasCalled = true;
-
- m_writer.write(XalanDOMChar(XalanUnicode::charAmpersand));
- m_writer.write(XalanDOMChar(XalanUnicode::charNumberSign));
-
- clear(m_stringBuffer);
-
- m_writer.write(UnsignedLongToDOMString(value, m_stringBuffer));
-
- m_writer.write(XalanDOMChar(XalanUnicode::charSemicolon));
}
- bool
- wasCalled()const
+ void
+ operator()(unsigned int value) const
{
- return m_wasCalled;
+ m_writer.writeNumericCharacterReference(value);
}
private:
- bool m_wasCalled;
-
- ThisType& m_writer;
-
- XalanDOMString m_stringBuffer;
+ ThisType& m_writer;
};
class ThrowTranscodingException
{
public:
- ThrowTranscodingException(ThisType& writer) :
- m_wasCalled(false),
+
+ ThrowTranscodingException(ThisType& writer) :
m_writer(writer)
{
}
void
- operator()(unsigned int value)
+ operator()(unsigned int value) const
{
- m_wasCalled = true;
-
m_writer.throwInvalidCharacterException(value, m_writer.getMemoryManager());
-
- }
-
- bool
- wasCalled()const
- {
- return m_wasCalled;
}
private:
- bool m_wasCalled;
-
- ThisType& m_writer;
+ ThisType& m_writer;
};
+ friend class WriteCharRef;
+ friend class ThrowTranscodingException;
+
+ typedef XalanDOMChar value_type;
-public:
- typedef XalanDOMChar value_type;
- typedef PresentableCharacterPredicat Predicat;
- typedef XalanDOMString::size_type size_type;
-
XalanOtherEncodingWriter(
Writer& writer,
MemoryManager& theMemoryManager) :
@@ -118,9 +88,10 @@
m_buffer(),
m_bufferPosition(m_buffer),
m_bufferRemaining(kBufferSize),
- m_stringBuffer(5, 0, theMemoryManager),
- m_isPresentable(writer.getStream()),
- m_constants()
+ m_predicate(writer.getStream()),
+ m_constants(),
+ m_charRefFunctor(*this),
+ m_exceptionFunctor(*this)
{
}
@@ -148,83 +119,76 @@
* with addition CDATA sections
*/
size_type
- writeCDATAChar(
- const XalanDOMChar chars[],
- size_type start,
- size_type length,
- int& state)
+ writeCDATAChar(
+ const XalanDOMChar chars[],
+ size_type start,
+ size_type length,
+ bool& outsideCDATA)
{
assert(chars != 0 && length > 0 && start < length);
- // enum for a cheezy little state machine.
- enum eState { eNormalState = 0, eOutOfCDATA = 1};
-
- const XalanDOMChar theChar = chars[start];
+ const XalanDOMChar theChar = chars[start];
- unsigned int value = 0;
+ unsigned int value = theChar;
size_type result = start;
- if (XalanFormatterWriter::isUTF16HighSurrogate(theChar) == false)
- {
- value = theChar;
- }
- else
+ if (isUTF16HighSurrogate(theChar) == true)
{
if (start + 1 >= length)
{
- XalanFormatterWriter::throwInvalidUTF16SurrogateException(
+ throwInvalidUTF16SurrogateException(
theChar,
0,
getMemoryManager());
}
else
{
- value = XalanFormatterWriter::decodeUTF16SurrogatePair(theChar, chars[start+1], getMemoryManager());
+ value = decodeUTF16SurrogatePair(theChar, chars[start+1], getMemoryManager());
++result;
}
}
- WriteCharRef charRefsWriter(*this);
-
- if(m_isPresentable(value))
+ if(m_predicate(value))
{
- if( eNormalState == state)
+ if (outsideCDATA == false)
{
- // we have a presentable char in the normal state - just print it
+ // We have a representable char in the normal state,
+ // so just print it.
write(value);
}
else
{
- // previose char was a non-presentable one . Open CDATA section again,
- // change the state to normal and print the char
+ // The previous character was a not representable.
+ // Open the CDATA section again, print the character,
+ // then change the flag.
write(
m_constants.s_cdataOpenString,
m_constants.s_cdataOpenStringLength);
write(value);
- state = eNormalState;
+ outsideCDATA = false;
}
}
- else // not presentable chracter
+ else
{
- if( eNormalState == state)
+ if(outsideCDATA == false)
{
- // we have a non presentable char in the normal state -
+ // we have a non-representable char in the normal state -
// close the CDATA section and print the value
write(
m_constants.s_cdataCloseString,
m_constants.s_cdataCloseStringLength);
- charRefsWriter( value );
+ writeNumericCharacterReference(value);
- state = eOutOfCDATA;
+ outsideCDATA = true;
}
else
{
- charRefsWriter( value );
+ writeNumericCharacterReference(value);
}
}
@@ -232,44 +196,48 @@
}
/**
- * Writes name chars , if not presentable, throws
+ * Writes name characters. If a character is not representable,
+ * an exception is thrown.
*/
- void writeNameChar(const XalanDOMChar* data,
- size_type theLength)
+ void
+ writeNameChar(
+ const XalanDOMChar* data,
+ size_type theLength)
{
- ThrowTranscodingException functor(*this);
-
for( size_type i = 0; i < theLength; ++i)
{
- i = write(data, i , theLength, functor);
+ i = write(data, i , theLength, m_exceptionFunctor);
}
}
/**
- * Writes name chars , if not presentable, throws
+ * Writes PI characters. If a character is not representable,
+ * an exception is thrown.
*/
- void writePIChars(const XalanDOMChar* data,
- size_type theLength)
+ void
+ writePIChars(
+ const XalanDOMChar* data,
+ size_type theLength)
{
- ThrowTranscodingException functor(*this);
-
for( size_type i = 0; i < theLength; )
{
- i = write(data, i , theLength, functor);
+ i = write(data, i , theLength, m_exceptionFunctor);
}
}
/**
- * Writes name chars , if not presentable, throws
+ * Writes comment characters. If a character is not representable,
+ * or must be written as a character reference for compatibility with
+ * XML 1.1, an exception is thrown.
*/
- void writeCommentChars(const XalanDOMChar* data,
- size_type theLength)
+ void
+ writeCommentChars(
+ const XalanDOMChar* data,
+ size_type theLength)
{
- ThrowTranscodingException functor(*this);
-
for( size_type i = 0; i < theLength; )
{
- i = write(data, i , theLength, functor);
+ i = write(data, i , theLength, m_exceptionFunctor);
}
}
@@ -278,12 +246,10 @@
const XalanDOMChar* theChars,
size_type theLength)
{
-
- for(XalanDOMString::size_type i = 0; i < theLength; ++i)
+ for(size_type i = 0; i < theLength; ++i)
{
write(theChars[i]);
}
-
}
void
@@ -293,64 +259,63 @@
}
/**
- * Writes writes a code point that isn't a part of the surrogate pair
+ * Writes writes a UTF-16 code unit that isn't
+ * part of the surrogate pair
*/
void
write(XalanDOMChar theChar)
{
-
+ assert(
+ isUTF16HighSurrogate(theChar) == false &&
+ isUTF16LowSurrogate(theChar) == false);
+
if (m_bufferRemaining == 0)
{
flushBuffer();
}
-
- if(m_isPresentable(theChar))
+
+ if(m_predicate(theChar))
{
*m_bufferPosition = theChar;
-
+
++m_bufferPosition;
--m_bufferRemaining;
}
else
{
- writeNumberedEntityReference(theChar);
+ writeNumericCharacterReference(theChar);
}
}
-
size_type
write(
- const XalanDOMChar chars[],
- XalanDOMString::size_type start,
- XalanDOMString::size_type length)
+ const XalanDOMChar chars[],
+ size_type start,
+ size_type length)
{
- WriteCharRef functor(*this);
-
- return write(chars, start, length, functor);
+ return write(chars, start, length, m_charRefFunctor);
}
void
writeSafe(
- const XalanDOMChar* theChars,
- XalanDOMString::size_type theLength)
+ const XalanDOMChar* theChars,
+ size_type theLength)
{
- XalanDOMChar ch = 0;
-
for(size_type i = 0; i < theLength; ++i)
{
- ch = theChars[i];
+ const XalanDOMChar ch = theChars[i];
- if (XalanFormatterWriter::isUTF16HighSurrogate(ch) == true)
+ if (isUTF16HighSurrogate(ch) == true)
{
if (i + 1 >= theLength)
{
- XalanFormatterWriter::throwInvalidUTF16SurrogateException(ch, 0, getMemoryManager());
+ throwInvalidUTF16SurrogateException(ch, 0, getMemoryManager());
}
else
{
- unsigned int value = XalanFormatterWriter::decodeUTF16SurrogatePair(ch, theChars[i+1], getMemoryManager());
-
+ unsigned int value = decodeUTF16SurrogatePair(ch, theChars[i+1], getMemoryManager());
+
if(m_isPresentable(value))
{
write(value);
@@ -359,7 +324,7 @@
{
writeNumberedEntityReference(value);
}
-
+
++i;
}
}
@@ -368,7 +333,6 @@
write((unsigned int)ch);
}
}
-
}
void
@@ -382,20 +346,20 @@
{
m_writer.flush();
}
-
+
void
flushBuffer()
{
- m_writer.write(m_buffer, 0, XalanDOMChar(m_bufferPosition - m_buffer));
-
+ m_writer.write(m_buffer, 0, m_bufferPosition - m_buffer);
+
m_bufferPosition = m_buffer;
m_bufferRemaining = kBufferSize;
}
-
+
private:
/**
- * Writes a presentable code point
+ * Writes a representable code point
*
* @param chars Array of the characters for transcoding
*
@@ -403,7 +367,7 @@
*
* @param length The length of the array
*
- * @param failreHandeler The functor handeles the non-representable characters
+ * @param failureHandler The functor handles the non-representable characters
*
* @return Place int the array of the next character
*/
@@ -414,71 +378,48 @@
const XalanDOMChar chars[],
size_type start,
size_type length,
- TranscodingFailureFunctor& failreHandeler)
+ TranscodingFailureFunctor& failureHandler)
{
- assert( chars != 0 && length > 0 );
- assert( start <= length);
-
+ assert(chars != 0 && length > 0);
+ assert(start <= length);
+
size_type result = start;
- XalanDOMChar ch = chars[start];
+ const XalanDOMChar ch = chars[start];
- unsigned int value = 0;
+ unsigned int value = ch;
- if (XalanFormatterWriter::isUTF16HighSurrogate(ch) == false)
- {
- value = ch;
- }
- else
+ if (XalanFormatterWriter::isUTF16HighSurrogate(ch) == true)
{
if (start + 1 >= length)
{
- XalanFormatterWriter::throwInvalidUTF16SurrogateException(
+ throwInvalidUTF16SurrogateException(
ch,
0,
getMemoryManager());
}
else
{
- value = XalanFormatterWriter::decodeUTF16SurrogatePair(ch, chars[start+1], getMemoryManager());
+ value = decodeUTF16SurrogatePair(ch, chars[start+1], getMemoryManager());
++result;
}
}
- if(m_isPresentable(value))
+ if(m_predicate(value))
{
write(value);
}
else
{
- failreHandeler(value);
+ failureHandler(value);
}
return result;
}
/**
- * Writes a presentable code point
- *
- * @param theChar UTF-32 code point . For passing it to the Xerces
- * transcoder, we convert it back to UTF-16
- */
-
- void
- writeNumberedEntityReference(unsigned long theNumber)
- {
- m_writer.write(XalanDOMChar(XalanUnicode::charAmpersand));
- m_writer.write(XalanDOMChar(XalanUnicode::charNumberSign));
-
- m_writer.write(UnsignedLongToDOMString(theNumber, m_stringBuffer));
- clear(m_stringBuffer);
-
- m_writer.write(XalanDOMChar(XalanUnicode::charSemicolon));
- }
-
- /**
- * Writes a presentable code point
+ * Writes a representable code point
*
* @param theChar UTF-32 code point . For passing it to the Xerces
* transcoder, we convert it back to UTF-16
@@ -487,7 +428,7 @@
write(unsigned int theChar)
{
// encode back UTF-32 into UTF-16
-
+
if( theChar > 0xFFFF )
{
if (m_bufferRemaining < 2)
@@ -502,7 +443,7 @@
*m_bufferPosition = (XalanDOMChar((theChar & 0x03FF) + 0xDC00));
++m_bufferPosition;
-
+
m_bufferRemaining = m_bufferRemaining - size_type(2);
}
else
@@ -519,26 +460,32 @@
}
}
+ void
+ writeNumericCharacterReference(unsigned int theNumber)
+ {
+ write(formatNumericCharacterReference(theNumber));
+ }
+
enum
{
- kBufferSize = 512 // The size of the buffer
+ kBufferSize = 512u // The size of the buffer
};
// Data members...
- XalanDOMChar m_buffer[kBufferSize];
+ XalanDOMChar m_buffer[kBufferSize];
+
+ XalanDOMChar* m_bufferPosition;
+
+ size_type m_bufferRemaining;
+
+ const Predicate m_predicate;
+
+ const ConstantsType m_constants;
- XalanDOMChar* m_bufferPosition;
+ const WriteCharRef m_charRefFunctor;
- size_type m_bufferRemaining;
-
- XalanDOMString m_stringBuffer;
-
- Predicat m_isPresentable;
-
- ConstantsType m_constants;
-
-
+ const ThrowTranscodingException m_exceptionFunctor;
};
1.4 +18 -19 xml-xalan/c/src/xalanc/XMLSupport/XalanUTF16Writer.hpp
Index: XalanUTF16Writer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XalanUTF16Writer.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanUTF16Writer.hpp 6 Jun 2005 01:32:45 -0000 1.3
+++ XalanUTF16Writer.hpp 7 Oct 2005 22:45:46 -0000 1.4
@@ -27,8 +27,7 @@
{
public:
- typedef XalanDOMChar value_type;
- typedef XalanDOMString::size_type size_type;
+ typedef XalanDOMChar value_type;
XalanUTF16Writer(
@@ -56,11 +55,11 @@
size_type
- writeCDATAChar(
- const XalanDOMChar chars[],
- size_type start,
- size_type /*length*/,
- int& /*state*/)
+ writeCDATAChar(
+ const XalanDOMChar chars[],
+ size_type start,
+ size_type /*length*/,
+ bool& /* outsideCDATA */)
{
assert( chars != 0 );
@@ -98,16 +97,16 @@
void
safeWriteContent(
- const XalanDOMChar* theChars,
- XalanDOMString::size_type theLength)
+ const XalanDOMChar* theChars,
+ size_type theLength)
{
write(theChars, theLength);
}
void
write(
- const value_type* theChars,
- XalanDOMString::size_type theLength)
+ const value_type* theChars,
+ size_type theLength)
{
if (theLength > sizeof(m_buffer))
{
@@ -158,9 +157,9 @@
size_type
write(
- const value_type chars[],
- XalanDOMString::size_type start,
- XalanDOMString::size_type /*length*/)
+ const value_type chars[],
+ size_type start,
+ size_type /*length*/)
{
write(chars[start]);
@@ -169,8 +168,8 @@
void
writeSafe(
- const XalanDOMChar* theChars,
- XalanDOMString::size_type theLength)
+ const XalanDOMChar* theChars,
+ size_type theLength)
{
write(theChars, theLength);
}
@@ -204,11 +203,11 @@
// Data members...
- value_type m_buffer[kBufferSize];
+ value_type m_buffer[kBufferSize];
- value_type* m_bufferPosition;
+ value_type* m_bufferPosition;
- XalanDOMString::size_type m_bufferRemaining;
+ size_type m_bufferRemaining;
};
1.4 +9 -9 xml-xalan/c/src/xalanc/XMLSupport/XalanUTF8Writer.hpp
Index: XalanUTF8Writer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XalanUTF8Writer.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanUTF8Writer.hpp 6 Jun 2005 01:32:45 -0000 1.3
+++ XalanUTF8Writer.hpp 7 Oct 2005 22:45:46 -0000 1.4
@@ -109,8 +109,7 @@
{
public:
- typedef char value_type;
- typedef XalanDOMString::size_type size_type;
+ typedef char value_type;
XalanUTF8Writer(
@@ -137,20 +136,21 @@
}
size_type
- writeCDATAChar(
- const XalanDOMChar chars[],
- size_type start,
- size_type length,
- int& /*state*/)
+ writeCDATAChar(
+ const XalanDOMChar chars[],
+ size_type start,
+ size_type length,
+ bool& /* outsideCDATA */)
{
- assert( chars != 0 && length != 0 && start < length);
+ assert(chars != 0 && length != 0 && start < length);
return write(chars, start, length);
}
+
/**
* Writes name chars , if not presentable, throws
*/
- void writeNameChar(const XalanDOMChar* data,
+ void writeNameChar(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
1.4 +10 -0 xml-xalan/c/src/xalanc/XMLSupport/XalanXMLSerializerBase.hpp
Index: XalanXMLSerializerBase.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XalanXMLSerializerBase.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanXMLSerializerBase.hpp 4 Aug 2005 18:01:40 -0000 1.3
+++ XalanXMLSerializerBase.hpp 7 Oct 2005 22:45:46 -0000 1.4
@@ -605,6 +605,16 @@
}
/**
+ * Determine if it a DOCTYPE declaration needs to
+ * be written.
+ */
+ bool
+ getNeedToOutputDoctypeDecl() const
+ {
+ return m_needToOutputDoctypeDecl;
+ }
+
+ /**
* Open an element for possibile children
*/
void
1.4 +25 -34 xml-xalan/c/src/xalanc/XMLSupport/XalanXMLSerializerFactory.cpp
Index: XalanXMLSerializerFactory.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XMLSupport/XalanXMLSerializerFactory.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanXMLSerializerFactory.cpp 4 Aug 2005 18:01:40 -0000 1.3
+++ XalanXMLSerializerFactory.cpp 7 Oct 2005 22:45:46 -0000 1.4
@@ -66,7 +66,6 @@
if (XalanTranscodingServices::encodingIsUTF8(fixedEncoding))
{
-
if (isVersion1_1 == true)
{
if(doIndent == true)
@@ -116,7 +115,6 @@
theStandaloneString,
theIndentAmount);
}
-
}
else // XML 1.0 section
{
@@ -127,7 +125,6 @@
typedef XalanIndentWriter<WhiteSpaceWriter,NewLineWriter> IndentWriter;
-
typedef FormatterToXMLUnicode<
XalanUTF8Writer,
XalanXMLSerializerBase::UTF8,
@@ -168,8 +165,6 @@
theStandaloneString,
theIndentAmount);
}
-
-
}
}
else if (XalanTranscodingServices::encodingIsUTF16(fixedEncoding))
@@ -181,13 +176,13 @@
typedef XalanFormatterWriter::NewLineWriterFunctor<XalanUTF16Writer> NewLineWriter;
typedef XalanFormatterWriter::WhiteSpaceWriterFunctor<XalanUTF16Writer> WhiteSpaceWriter;
- typedef XalanIndentWriter<WhiteSpaceWriter,NewLineWriter> IdentWriter;
+ typedef XalanIndentWriter<WhiteSpaceWriter, NewLineWriter> IndentWriter;
typedef FormatterToXMLUnicode<
XalanUTF16Writer,
XalanXMLSerializerBase::UTF16,
XalanXMLSerializerBase::CharFunctor1_1,
- IdentWriter,
+ IndentWriter,
FormatterListener::XML_VERSION_1_1> Type;
theFormatter =
@@ -203,13 +198,13 @@
}
else //doIndent == false
{
- typedef XalanDummyIndentWriter<XalanUTF16Writer> IdentWriter;
+ typedef XalanDummyIndentWriter<XalanUTF16Writer> IndentWriter;
typedef FormatterToXMLUnicode<
XalanUTF16Writer,
XalanXMLSerializerBase::UTF16,
XalanXMLSerializerBase::CharFunctor1_1,
- IdentWriter,
+ IndentWriter,
FormatterListener::XML_VERSION_1_1> Type;
theFormatter =
@@ -231,49 +226,48 @@
typedef XalanFormatterWriter::NewLineWriterFunctor<XalanUTF16Writer> NewLineWriter;
typedef XalanFormatterWriter::WhiteSpaceWriterFunctor<XalanUTF16Writer> WhiteSpaceWriter;
- typedef XalanIndentWriter<WhiteSpaceWriter,NewLineWriter> IdentWriter;
+ typedef XalanIndentWriter<WhiteSpaceWriter,NewLineWriter> IndentWriter;
typedef FormatterToXMLUnicode<
XalanUTF16Writer,
XalanXMLSerializerBase::UTF16,
XalanXMLSerializerBase::CharFunctor1_0,
- IdentWriter,
+ IndentWriter,
FormatterListener::XML_VERSION_1_0> Type;
theFormatter =
Type::create(
- theManager,
- theWriter,
- fixedEncoding,
- theDoctypeSystem,
- theDoctypePublic,
- generateXMLDeclaration,
- theStandaloneString,
- theIndentAmount);
+ theManager,
+ theWriter,
+ fixedEncoding,
+ theDoctypeSystem,
+ theDoctypePublic,
+ generateXMLDeclaration,
+ theStandaloneString,
+ theIndentAmount);
}
- else // doIndent == flase
+ else // doIndent == false
{
- typedef XalanDummyIndentWriter<XalanUTF16Writer> IdentWriter;
+ typedef XalanDummyIndentWriter<XalanUTF16Writer> IndentWriter;
typedef FormatterToXMLUnicode<
XalanUTF16Writer,
XalanXMLSerializerBase::UTF16,
XalanXMLSerializerBase::CharFunctor1_0,
- IdentWriter,
+ IndentWriter,
FormatterListener::XML_VERSION_1_0> Type;
theFormatter =
Type::create(
- theManager,
- theWriter,
- fixedEncoding,
- theDoctypeSystem,
- theDoctypePublic,
- generateXMLDeclaration,
- theStandaloneString,
- theIndentAmount);
+ theManager,
+ theWriter,
+ fixedEncoding,
+ theDoctypeSystem,
+ theDoctypePublic,
+ generateXMLDeclaration,
+ theStandaloneString,
+ theIndentAmount);
}
-
}
}
else // all other encodings
@@ -330,7 +324,6 @@
generateXMLDeclaration,
theStandaloneString,
theIndentAmount);
-
}
}
else // XML 1.0 section
@@ -381,10 +374,8 @@
generateXMLDeclaration,
theStandaloneString,
theIndentAmount);
-
}
}
-
}
assert (theFormatter != 0);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org