[GME-commit] GMESRC/GME/Include/xalanc/XMLSupport FormatterToXMLUnicode.hpp, NONE, 1.1 XalanDummyIndentWriter.hpp, NONE, 1.1 XalanFormatterWriter.hpp, NONE, 1.1 XalanIndentWriter.hpp, NONE, 1.1 XalanOtherEncodingWriter.hpp, NONE, 1.1 XalanUTF16Writer.hpp, NONE, 1.1 XalanUTF8Writer.hpp, NONE, 1.1 XalanXMLSerializerBase.hpp, NONE, 1.1 XalanXMLSerializerFactory.hpp, NONE, 1.1 FormatterToDOM.hpp, 1.1.1.1, 1.2 FormatterToHTML.hpp, 1.1.1.1, 1.2 FormatterToNull.hpp, 1.1.1.1, 1.2 FormatterToText.hpp, 1.1.1.1, 1.2 FormatterToXML.hpp, 1.1.1.1, 1.2 FormatterTreeWalker.hpp, 1.1.1.1, 1.2 XMLParserLiaison.hpp, 1.1.1.1, 1.2 XMLSupportDefinitions.hpp, 1.1.1.1, 1.2 XMLSupportException.hpp, 1.1.1.1, 1.2 XMLSupportInit.hpp, 1.1.1.1, 1.2 XalanHTMLElementsProperties.hpp, 1.1.1.1, 1.2
Log messages of CVS commits
gme-commit at list.isis.vanderbilt.edu
Tue Feb 19 14:14:05 CST 2008
- Previous message: [GME-commit] GMESRC/GME/Include/xalanc/XercesParserLiaison XercesWrapperNavigatorAllocator.hpp, NONE, 1.1 FormatterToXercesDOM.hpp, 1.1.1.1, 1.2 XercesAttrWrapper.hpp, 1.1.1.1, 1.2 XercesAttrWrapperAllocator.hpp, 1.1.1.1, 1.2 XercesCDATASectionWrapper.hpp, 1.1.1.1, 1.2 XercesCommentWrapper.hpp, 1.1.1.1, 1.2 XercesDOMException.hpp, 1.1.1.1, 1.2 XercesDOMFormatterWalker.hpp, 1.1.1.1, 1.2 XercesDOMImplementationWrapper.hpp, 1.1.1.1, 1.2 XercesDOMSupport.hpp, 1.1.1.1, 1.2 XercesDOMWalker.hpp, 1.1.1.1, 1.2 XercesDOMWrapperException.hpp, 1.1.1.1, 1.2 XercesDocumentTypeWrapper.hpp, 1.1.1.1, 1.2 XercesDocumentWrapper.hpp, 1.1.1.1, 1.2 XercesElementWrapper.hpp, 1.1.1.1, 1.2 XercesElementWrapperAllocator.hpp, 1.1.1.1, 1.2 XercesEntityReferenceWrapper.hpp, 1.1.1.1, 1.2 XercesEntityWrapper.hpp, 1.1.1.1, 1.2 XercesLiaisonXalanDOMStringPool.hpp, 1.1.1.1, 1.2 XercesNamedNodeMapAttributeList.hpp, 1.1.1.1, 1.2 XercesNamedNodeMapWrapper.hpp, 1.1.1.1, 1.2 XercesNodeListWrapper.hpp, 1.1.1.1, 1.2 XercesNotationWrapper.hpp, 1.1.1.1, 1.2 XercesPar serLiaison.hpp, 1.1.1.1, 1.2 XercesParserLiaisonDefinitions.hpp, 1.1.1.1, 1.2 XercesProcessingInstructionWrapper.hpp, 1.1.1.1, 1.2 XercesTextWrapper.hpp, 1.1.1.1, 1.2 XercesTextWrapperAllocator.hpp, 1.1.1.1, 1.2 XercesWrapperHelper.hpp, 1.1.1.1, 1.2 XercesWrapperNavigator.hpp, 1.1.1.1, 1.2 XercesWrapperToXalanNodeMap.hpp, 1.1.1.1, 1.2 XercesWrapperTypes.hpp, 1.1.1.1, 1.2
- Next message: [GME-commit] GMESRC/GME/Include/xalanc/XalanDOM XalanAttr.hpp, 1.1.1.1, 1.2 XalanCDATASection.hpp, 1.1.1.1, 1.2 XalanCharacterData.hpp, 1.1.1.1, 1.2 XalanComment.hpp, 1.1.1.1, 1.2 XalanDOMDefinitions.hpp, 1.1.1.1, 1.2 XalanDOMException.hpp, 1.1.1.1, 1.2 XalanDOMImplementation.hpp, 1.1.1.1, 1.2 XalanDOMInit.hpp, 1.1.1.1, 1.2 XalanDOMString.hpp, 1.1.1.1, 1.2 XalanDocument.hpp, 1.1.1.1, 1.2 XalanDocumentFragment.hpp, 1.1.1.1, 1.2 XalanDocumentType.hpp, 1.1.1.1, 1.2 XalanElement.hpp, 1.1.1.1, 1.2 XalanEmptyNamedNodeMap.hpp, 1.1.1.1, 1.2 XalanEntity.hpp, 1.1.1.1, 1.2 XalanEntityReference.hpp, 1.1.1.1, 1.2 XalanNamedNodeMap.hpp, 1.1.1.1, 1.2 XalanNode.hpp, 1.1.1.1, 1.2 XalanNodeList.hpp, 1.1.1.1, 1.2 XalanNodeListDummy.hpp, 1.1.1.1, 1.2 XalanNodeListSurrogate.hpp, 1.1.1.1, 1.2 XalanNotation.hpp, 1.1.1.1, 1.2 XalanProcessingInstruction.hpp, 1.1.1.1, 1.2 XalanText.hpp, 1.1.1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport
In directory escher:/tmp/cvs-serv25974/XMLSupport
Modified Files:
FormatterToDOM.hpp FormatterToHTML.hpp FormatterToNull.hpp
FormatterToText.hpp FormatterToXML.hpp FormatterTreeWalker.hpp
XMLParserLiaison.hpp XMLSupportDefinitions.hpp
XMLSupportException.hpp XMLSupportInit.hpp
XalanHTMLElementsProperties.hpp
Added Files:
FormatterToXMLUnicode.hpp XalanDummyIndentWriter.hpp
XalanFormatterWriter.hpp XalanIndentWriter.hpp
XalanOtherEncodingWriter.hpp XalanUTF16Writer.hpp
XalanUTF8Writer.hpp XalanXMLSerializerBase.hpp
XalanXMLSerializerFactory.hpp
Log Message:
Xalan1.10 include files.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: FormatterToXML.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/FormatterToXML.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** FormatterToXML.hpp 8 Apr 2004 07:56:57 -0000 1.1.1.1
--- FormatterToXML.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
[...2273 lines suppressed...]
! */
! const XalanDOMChar* m_newlineString;
! /**
! * The length of the the string of characters that represents the newline
! */
! XalanDOMString::size_type m_newlineStringLength;
! bool m_isXML1_1;
};
***************
*** 1194,1196 ****
! #endif // FORMATTERTOXML_HEADER_GUARD_1357924680
--- 1177,1179 ----
! #endif // FORMATTERTOXML_HEADER_GUARD_1357924680
--- NEW FILE: XalanXMLSerializerFactory.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANXMLSERIALIZERFACTORY_HEADER_GUARD_1357924680)
#define XALANXMLSERIALIZERFACTORY_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include "xalanc/XMLSupport/XMLSupportDefinitions.hpp"
#include <xercesc/framework/MemoryManager.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class FormatterListener;
class Writer;
class XalanDOMString;
XALAN_USING_XERCES(MemoryManager)
/**
* A factory class for creating XML serializers.
*/
class XALAN_XMLSUPPORT_EXPORT XalanXMLSerializerFactory
{
public:
/**
* Create a FormatterListener for generating XML markup.
*/
static FormatterListener*
create(
MemoryManager& theManager,
Writer& theWriter,
const XalanDOMString& theVersion,
bool doIndent,
int theIndentAmount,
const XalanDOMString& theEncoding,
const XalanDOMString& theMediaType,
const XalanDOMString& theDoctypeSystem,
const XalanDOMString& theDoctypePublic,
bool generateXMLDeclaration,
const XalanDOMString& theStandaloneString);
private:
static void
setEncoding(
MemoryManager& theManager,
Writer& theWriter,
XalanDOMString& theEncoding);
// These are not implemented.
XalanXMLSerializerFactory(const XalanXMLSerializerFactory&);
XalanXMLSerializerFactory&
operator=(const XalanXMLSerializerFactory&);
bool
operator==(const XalanXMLSerializerFactory&) const;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANXMLSERIALIZERFACTORY_HEADER_GUARD_1357924680
--- NEW FILE: XalanDummyIndentWriter.hpp ---
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANDUMMYIDENTWRITER_HEADER_GUARD_1357924680)
#define XALANDUMMYIDENTWRITER_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
#include <xalanc/Include/XalanVector.hpp>
XALAN_CPP_NAMESPACE_BEGIN
template<class WriteHandeler>
class XalanDummyIndentWriter
{
public:
typedef typename WriteHandeler::size_type size_type;
typedef typename WriteHandeler::value_type value_type;
XalanDummyIndentWriter(
WriteHandeler& /*writer*/,
size_type /*ident*/)
{
}
~XalanDummyIndentWriter()
{
}
void
setIndent(size_type /*value*/)
{
}
size_type
getIndent()const
{
return 0;
}
void
indent()
{
}
void
increaseIndent()
{
}
void
decreaseIndent()
{
}
void
setStartNewLine(bool /*value*/)
{
}
/**
* Output a line break.
*/
void
outputLineSep()
{
}
void
setPrevText(bool /*value*/)
{
}
void
setPreserve(bool /*value*/)
{
// Empty of the function
}
void
pop_preserve()
{
// Empty body of the function
}
void
push_preserve()
{
// Empty of the function
}
private:
};
XALAN_CPP_NAMESPACE_END
#endif // XALANDUMMYIDENTWRITER_HEADER_GUARD_1357924680
Index: XMLSupportDefinitions.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/XMLSupportDefinitions.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XMLSupportDefinitions.hpp 8 Apr 2004 07:56:59 -0000 1.1.1.1
--- XMLSupportDefinitions.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(XMLSUPPORT_DEFINITIONS_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(XMLSUPPORT_DEFINITIONS_HEADER_GUARD_1357924680)
Index: XMLSupportInit.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/XMLSupportInit.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XMLSupportInit.hpp 8 Apr 2004 07:56:59 -0000 1.1.1.1
--- XMLSupportInit.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
***************
*** 83,87 ****
explicit
! XMLSupportInit();
~XMLSupportInit();
--- 42,46 ----
explicit
! XMLSupportInit(MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
~XMLSupportInit();
***************
*** 97,101 ****
static void
! initialize();
static void
--- 56,60 ----
static void
! initialize(MemoryManagerType& theManager);
static void
--- NEW FILE: XalanUTF8Writer.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANUTF8WRITER_HEADER_GUARD_1357924680)
#define XALANUTF8WRITER_HEADER_GUARD_1357924680
#include <xalanc/XMLSupport/XalanFormatterWriter.hpp>
XALAN_CPP_NAMESPACE_BEGIN
inline char
bits19to21(unsigned int theChar)
{
return char((theChar >> 18) & 0x7);
}
inline char
bits13to18(unsigned int theChar)
{
return char((theChar >> 12) & 0x3F);
}
inline char
bits13to16(unsigned int theChar)
{
return char((theChar >> 12) & 0xF);
}
inline char
bits7to12(unsigned int theChar)
{
return char((theChar >> 6) & 0x3f);
}
inline char
bits7to11(unsigned int theChar)
{
return char((theChar >> 6) & 0x1f);
}
inline char
bits1to6(unsigned int theChar)
{
return char(theChar & 0x3f);
}
inline char
leadingByteOf2(char theBits)
{
return char(0xC0 + theBits);
}
inline char
leadingByteOf3(char theBits)
{
return char(0xE0 + theBits);
}
inline char
leadingByteOf4(char theBits)
{
return char(0xF0 + theBits);
}
inline char
trailingByte(char theBits)
{
return char(0x80 + theBits);
}
class XalanUTF8Writer : public XalanFormatterWriter
{
public:
typedef char value_type;
XalanUTF8Writer(
Writer& writer,
MemoryManager& theMemoryManager);
virtual
~XalanUTF8Writer()
{
}
/**
* Output a line break.
*/
void
outputNewline()
{
assert(m_newlineString != 0);
assert(length(m_newlineString) == m_newlineStringLength);
write(
m_newlineString,
m_newlineStringLength);
}
size_type
writeCDATAChar(
const XalanDOMChar chars[],
size_type start,
size_type length,
bool& /* outsideCDATA */)
{
assert(chars != 0 && length != 0 && start < length);
return write(chars, start, length);
}
/**
* Writes name chars , if not presentable, throws
*/
void writeNameChar(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
}
/**
* Writes name chars , if not presentable, throws
*/
void writePIChars(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
}
/**
* Writes name chars , if not presentable, throws
*/
void writeCommentChars(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
}
void
safeWriteContent(
const XalanDOMChar* theChars,
XalanDOMString::size_type theLength)
{
for(size_type i = 0; i < theLength; ++i)
{
write(value_type(theChars[i]));
}
}
void
write(
const value_type* theChars,
XalanDOMString::size_type theLength)
{
#if defined(NDEBUG)
if (theLength > sizeof(m_buffer))
{
flushBuffer();
m_writer.write(theChars, 0, theLength);
}
else
{
if (m_bufferRemaining < theLength)
{
flushBuffer();
}
for(size_type i = 0; i < theLength; ++i)
{
*m_bufferPosition = theChars[i];
++m_bufferPosition;
}
m_bufferRemaining -= theLength;
}
#else
for(XalanDOMString::size_type i = 0; i < theLength; ++i)
{
write(theChars[i]);
}
#endif
}
void
write(const XalanDOMChar* theChars)
{
write(theChars, XalanDOMString::length(theChars));
}
void
write(const XalanDOMString& theChars)
{
write(theChars.c_str(), theChars.length());
}
void
write(value_type theChar)
{
assert(theChar < 128);
if (m_bufferRemaining == 0)
{
flushBuffer();
}
*m_bufferPosition = theChar;
++m_bufferPosition;
--m_bufferRemaining;
}
void
write(
const XalanDOMChar* theChars,
XalanDOMString::size_type theLength)
{
for(size_type i = 0; i < theLength; ++i)
{
write((unsigned int)theChars[i]);
}
}
size_type
write(
const XalanDOMChar chars[],
XalanDOMString::size_type start,
XalanDOMString::size_type length)
{
XalanDOMChar ch = chars[start];
if (XalanFormatterWriter::isUTF16HighSurrogate(ch) == false)
{
write((unsigned int)ch);
}
else
{
if (start + 1 >= length)
{
XalanFormatterWriter::throwInvalidUTF16SurrogateException(
ch,
0,
getMemoryManager());
}
else
{
write(
XalanFormatterWriter::decodeUTF16SurrogatePair(
ch,
chars[++start],
getMemoryManager()));
}
}
return start;
}
void
writeSafe(
const XalanDOMChar* theChars,
XalanDOMString::size_type theLength)
{
XalanDOMChar ch = 0;
for(size_type i = 0; i < theLength; ++i)
{
ch = theChars[i];
if (XalanFormatterWriter::isUTF16HighSurrogate(ch) == true)
{
if (i + 1 >= theLength)
{
XalanFormatterWriter::throwInvalidUTF16SurrogateException(ch, 0, getMemoryManager());
}
else
{
write(XalanFormatterWriter::decodeUTF16SurrogatePair(ch, theChars[i+1], getMemoryManager()));
++i;
}
}
else
{
write((unsigned int)ch);
}
}
}
void
write(const value_type* theChars)
{
write(theChars, XalanDOMString::length(theChars));
}
void
flushWriter()
{
m_writer.flush();
}
void
flushBuffer()
{
m_writer.write(m_buffer, 0, m_bufferPosition - m_buffer);
m_bufferPosition = m_buffer;
m_bufferRemaining = kBufferSize;
}
private:
void
write(unsigned int theChar)
{
if (theChar <= 0x7F)
{
write(char(theChar));
}
else if (theChar <= 0x7FF)
{
if (m_bufferRemaining < 2)
{
flushBuffer();
}
*m_bufferPosition = leadingByteOf2(bits7to11(theChar));
++m_bufferPosition;
*m_bufferPosition = trailingByte(bits1to6(theChar));
++m_bufferPosition;
m_bufferRemaining -= 2;
}
else if (theChar <= 0xFFFF)
{
// We should never get a high or low surrogate here...
assert(theChar < 0xD800 || theChar > 0xDBFF);
assert(theChar < 0xDC00 || theChar > 0xDFFF);
if (m_bufferRemaining < 3)
{
flushBuffer();
}
*m_bufferPosition = leadingByteOf3(bits13to16(theChar));
++m_bufferPosition;
*m_bufferPosition = trailingByte(bits7to12(theChar));
++m_bufferPosition;
*m_bufferPosition = trailingByte(bits1to6(theChar));
++m_bufferPosition;
m_bufferRemaining -= 3;
}
else if (theChar <= 0x10FFFF)
{
if (m_bufferRemaining < 4)
{
flushBuffer();
}
*m_bufferPosition = leadingByteOf4(bits19to21(theChar));
++m_bufferPosition;
*m_bufferPosition = trailingByte(bits13to18(theChar));
++m_bufferPosition;
*m_bufferPosition = trailingByte(bits7to12(theChar));
++m_bufferPosition;
*m_bufferPosition = trailingByte(bits1to6(theChar));
++m_bufferPosition;
m_bufferRemaining -= 4;
}
else
{
XalanFormatterWriter::throwInvalidCharacterException(theChar, getMemoryManager());
}
}
enum
{
kBufferSize = 512 // The size of the buffer
};
// Data members...
value_type m_buffer[kBufferSize];
value_type* m_bufferPosition;
XalanDOMString::size_type m_bufferRemaining;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANUTF8WRITER_HEADER_GUARD_1357924680
--- NEW FILE: XalanIndentWriter.hpp ---
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANIDENTWRITER_HEADER_GUARD_1357924680)
#define XALANIDENTWRITER_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
#include <xalanc/Include/XalanVector.hpp>
#include <xalanc/PlatformSupport/Writer.hpp>
XALAN_CPP_NAMESPACE_BEGIN
template<class WhiteSpaceWriter,
class NewLineWriter>
class XalanIndentWriter
{
public:
typedef typename XalanDOMString::size_type size_type;
typedef XalanVector<bool> BoolStackType;
typedef typename WhiteSpaceWriter::writer_type writer_type;
XalanIndentWriter(
writer_type& writer,
size_type ident) :
m_whiteSpaceWriter(writer),
m_newLineWriter(writer),
m_indent(ident),
m_currentIndent(0),
m_startNewLine(false),
m_ispreserve(false),
m_isprevtext(false),
m_preserves(writer.getMemoryManager(), 5)
{
assert( m_indent != -1);
}
~XalanIndentWriter()
{
}
void
setIndent(size_type value)
{
m_indent = value;
}
size_type
getIndent()const
{
return m_indent;
}
void
indent()
{
if( shouldIndent() )
{
if(m_startNewLine == true)
{
m_newLineWriter();
}
m_whiteSpaceWriter(m_currentIndent);
}
}
void
increaseIndent()
{
m_currentIndent += m_indent;
}
void
decreaseIndent()
{
assert( m_currentIndent >= m_indent);
m_currentIndent -= m_indent;
}
void
setStartNewLine(bool value)
{
m_startNewLine = value;
}
/**
* Output a line break.
*/
void
outputLineSep()
{
m_newLineWriter();
}
void
setPrevText(bool value)
{
m_isprevtext = value;
}
void
setPreserve(bool value)
{
m_ispreserve = value;
}
void
pop_preserve()
{
if ( m_preserves.empty() )
{
m_ispreserve = false;
}
else
{
m_ispreserve = m_preserves.back();
m_preserves.pop_back();
}
}
void
push_preserve()
{
m_preserves.push_back(m_ispreserve);
}
private:
bool
shouldIndent() const
{
return (!m_ispreserve && !m_isprevtext);
// return true;
}
private:
//data members
WhiteSpaceWriter m_whiteSpaceWriter;
NewLineWriter m_newLineWriter;
/**
* Amount to indent.
*/
size_type m_indent;
/**
* Flag to keep track of the indent amount.
*/
size_type m_currentIndent;
/**
* Flag to signal that a newline should be added.
*/
bool m_startNewLine;
/**
* State flag to tell if preservation of whitespace
* is important.
*/
bool m_ispreserve;
/**
* State flag that tells if the previous node processed
* was text, so we can tell if we should preserve whitespace.
*/
bool m_isprevtext;
/**
* Stack to keep track of whether or not we need to
* preserve whitespace.
*/
BoolStackType m_preserves;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANIDENTWRITER_HEADER_GUARD_1357924680
--- NEW FILE: FormatterToXMLUnicode.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(FORMATTERTOXML_UNICODE_HEADER_GUARD_1357924680)
#define FORMATTERTOXML_UNICODE_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include "xalanc/XMLSupport/XMLSupportDefinitions.hpp"
#include "xalanc/XMLSupport/XalanXMLSerializerBase.hpp"
#include "xercesc/sax/AttributeList.hpp"
#include "xalanc/PlatformSupport/DoubleSupport.hpp"
#include "xalanc/PlatformSupport/XalanOutputStream.hpp"
#include "xalanc/PlatformSupport/XalanUnicode.hpp"
#include <xalanc/DOMSupport/DOMServices.hpp>
XALAN_CPP_NAMESPACE_BEGIN
/**
* FormatterToXMLUnicode formats SAX-style events into XML.
*/
template<
class UnicodeWriter,
class ConstantsType,
class CharPredicate,
class IndentHandler,
FormatterListener::eXMLVersion XMLVersion>
class XALAN_XMLSUPPORT_EXPORT FormatterToXMLUnicode : public XalanXMLSerializerBase
{
public:
typedef typename UnicodeWriter::value_type value_type;
enum
{
eDefaultIndentAmount = 0
};
/**
* Constructor
*
* @param theManager The MemoryManager instance to use for all memory allocations
* @param writer the writer.
* @param version the string to write for the XML version number.
* @param doctypeSystem system identifier to be used in the document
* type declaration
* @param doctypePublic public identifier to be used in the document
* type declaration
* @param xmlDecl true if the XSLT processor should output an XML
* declaration
* @param standalone The string the XSLT processor should output for
* the standalone document declaration
*
*/
FormatterToXMLUnicode(
MemoryManager& theManager,
Writer& writer,
const XalanDOMString& encoding,
const XalanDOMString& doctypeSystem = s_emptyString,
const XalanDOMString& doctypePublic = s_emptyString,
bool xmlDecl = true,
const XalanDOMString& standalone = s_emptyString,
size_type indent = eDefaultIndentAmount) :
XalanXMLSerializerBase(
theManager,
XMLVersion,
encoding,
doctypeSystem,
doctypePublic,
xmlDecl,
standalone),
m_stringBuffer(theManager),
m_writer(writer, theManager),
m_constants(),
m_charPredicate(),
m_indentHandler(m_writer , indent)
{
}
static FormatterToXMLUnicode*
create(
MemoryManagerType& theManager,
Writer& writer,
const XalanDOMString& encoding,
const XalanDOMString& doctypeSystem = s_emptyString,
const XalanDOMString& doctypePublic = s_emptyString,
bool xmlDecl = true,
const XalanDOMString& standalone = s_emptyString,
size_type indent = eDefaultIndentAmount)
{
typedef FormatterToXMLUnicode ThisType;
XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (ThisType*)theManager.allocate(sizeof(ThisType)));
ThisType* theResult = theGuard.get();
new (theResult) ThisType(
theManager,
writer,
encoding,
doctypeSystem,
doctypePublic,
xmlDecl,
standalone,
indent);
theGuard.release();
return theResult;
}
virtual
~FormatterToXMLUnicode()
{
}
Writer*
getWriter() const
{
return m_writer.getWriter();
}
// These are inherited from XalanXMLSerializerBase...
virtual void
endDocument()
{
m_indentHandler.setStartNewLine(true);
m_indentHandler.indent();
flushBuffer();
}
virtual void
startElement(
const XMLCh* const name,
AttributeList& attrs)
{
generateDoctypeDecl(name);
writeParentTagEnd();
m_indentHandler.setPreserve(false);
m_indentHandler.indent();
m_indentHandler.setStartNewLine(true);
m_writer.write(value_type(XalanUnicode::charLessThanSign));
writeName(name);
const unsigned int nAttrs = attrs.getLength();
for (unsigned int i = 0; i < nAttrs ; i++)
{
processAttribute(attrs.getName(i), attrs.getValue(i));
}
// Flag the current element as not yet having any children.
openElementForChildren();
m_indentHandler.increaseIndent();
m_indentHandler.setPrevText(false);
}
virtual void
endElement(const XMLCh* const name)
{
m_indentHandler.decreaseIndent();
const bool hasChildNodes = childNodesWereAdded();
if (hasChildNodes == true)
{
m_indentHandler.indent();
m_writer.write(value_type(XalanUnicode::charLessThanSign));
m_writer.write(value_type(XalanUnicode::charSolidus));
writeName(name);
}
else
{
if(m_spaceBeforeClose == true)
{
m_writer.write(value_type(XalanUnicode::charSpace));
}
m_writer.write(value_type(XalanUnicode::charSolidus));
}
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
if (hasChildNodes == true)
{
m_indentHandler.pop_preserve();
}
m_indentHandler.setPrevText(false);
}
virtual void
charactersRaw(
const XMLCh* const chars,
const unsigned int length)
{
writeParentTagEnd();
m_indentHandler.setPreserve(true);
m_writer.write(chars, length);
}
virtual void
entityReference(const XMLCh* const name)
{
writeParentTagEnd();
m_indentHandler.indent();
m_writer.write(value_type(XalanUnicode::charAmpersand));
writeName(name);
m_writer.write(value_type(XalanUnicode::charSemicolon));
}
virtual void
comment(const XMLCh* const data)
{
writeParentTagEnd();
m_indentHandler.indent();
m_writer.write(value_type(XalanUnicode::charLessThanSign));
m_writer.write(value_type(XalanUnicode::charExclamationMark));
m_writer.write(value_type(XalanUnicode::charHyphenMinus));
m_writer.write(value_type(XalanUnicode::charHyphenMinus));
writeNormalizedData(data, XalanDOMString::length(data));
m_writer.write(value_type(XalanUnicode::charHyphenMinus));
m_writer.write(value_type(XalanUnicode::charHyphenMinus));
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
m_indentHandler.setStartNewLine(true);
}
virtual const XalanDOMString&
getEncoding() const
{
return m_constants.s_encodingString;
}
protected:
virtual void
flushBuffer()
{
m_writer.flushBuffer();
}
void
writeXMLHeader()
{
// "<?xml version=\""
m_writer.write(
m_constants.s_xmlHeaderStartString,
m_constants.s_xmlHeaderStartStringLength);
if (length(m_version) != 0)
{
m_writer.write(m_version);
}
else
{
m_writer.write(
m_constants.s_defaultVersionString,
m_constants.s_defaultVersionStringLength);
}
// "\" encoding=\""
m_writer.write(
m_constants.s_xmlHeaderEncodingString,
m_constants.s_xmlHeaderEncodingStringLength);
m_writer.write(m_encoding);
if (length(m_standalone) != 0)
{
m_writer.write(
m_constants.s_xmlHeaderStandaloneString,
m_constants.s_xmlHeaderStandaloneStringLength);
m_writer.write(m_standalone);
}
m_writer.write(
m_constants.s_xmlHeaderEndString,
m_constants.s_xmlHeaderEndStringLength);
if (getNeedToOutputDoctypeDecl() == false)
{
m_indentHandler.outputLineSep();
}
}
void
writeDoctypeDecl(const XalanDOMChar* name)
{
// "<!DOCTYPE "
m_writer.write(
m_constants.s_doctypeHeaderStartString,
m_constants.s_doctypeHeaderStartStringLength);
m_writer.write(name);
if(length(m_doctypePublic) != 0)
{
// " PUBLIC \""
m_writer.write(
m_constants.s_doctypeHeaderPublicString,
m_constants.s_doctypeHeaderPublicStringLength);
writeName(m_doctypePublic.c_str());
m_writer.write(value_type(XalanUnicode::charQuoteMark));
m_writer.write(value_type(XalanUnicode::charSpace));
m_writer.write(value_type(XalanUnicode::charQuoteMark));
}
else
{
// " SYSTEM \""
m_writer.write(
m_constants.s_doctypeHeaderSystemString,
m_constants.s_doctypeHeaderSystemStringLength);
}
writeName(m_doctypeSystem.c_str());
m_writer.write(value_type(XalanUnicode::charQuoteMark));
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
outputNewline();
}
void
writeProcessingInstruction(
const XMLCh* target,
const XMLCh* data)
{
writeParentTagEnd();
m_indentHandler.indent();
m_writer.write(value_type(XalanUnicode::charLessThanSign));
m_writer.write(value_type(XalanUnicode::charQuestionMark));
writeName(target);
const XalanDOMString::size_type len = length(data);
// We need to make sure there is a least one whitespace character
// between the target and the data.
if ( len > 0 && !isXMLWhitespace(data[0]))
{
m_writer.write(value_type(XalanUnicode::charSpace));
}
writeNormalizedData(data, len);
m_writer.write(value_type(XalanUnicode::charQuestionMark));
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
// If outside of an element, then put in a new line. This whitespace
// is not significant.
if (outsideDocumentElement() == true)
{
outputNewline();
}
}
void
writeCharacters(
const XMLCh* chars,
unsigned int length)
{
assert(length != 0);
writeParentTagEnd();
m_indentHandler.setPreserve(true);
unsigned int i = 0;
unsigned int firstIndex = 0;
while(i < length)
{
const XalanDOMChar ch = chars[i];
if(m_charPredicate.range(ch) == true)
{
safeWriteContent(chars + firstIndex, i - firstIndex);
i = writeNormalizedCharBig(chars, i, length);
++i;
firstIndex = i;
}
else if(m_charPredicate.content(ch) == false)
{
++i;
}
else
{
safeWriteContent(chars + firstIndex, i - firstIndex);
writeDefaultEscape(ch);
++i;
firstIndex = i;
}
}
safeWriteContent(chars + firstIndex, i - firstIndex);
m_indentHandler.setPrevText(true);
}
void
writeCDATA(
const XMLCh* chars,
unsigned int length)
{
assert(length != 0);
writeParentTagEnd();
m_indentHandler.setPreserve(true);
m_indentHandler.indent();
m_writer.write(
m_constants.s_cdataOpenString,
m_constants.s_cdataOpenStringLength);
bool outsideCDATA = false;
writeCDATAChars(chars, length, outsideCDATA);
if (outsideCDATA == false)
{
m_writer.write(
m_constants.s_cdataCloseString,
m_constants.s_cdataCloseStringLength);
}
}
/**
* Output a line break.
*/
void
outputNewline()
{
m_writer.outputNewline();
}
/**
* Escape and write a character.
*/
void
writeDefaultEscape(XalanDOMChar ch)
{
assert(m_charPredicate.content(ch) == true);
if(!writeDefaultEntity(ch))
{
if (XalanUnicode::charLF == ch)
{
outputNewline();
}
else
{
if(m_charPredicate.isForbidden(ch) == true)
{
throwInvalidXMLCharacterException(
ch,
m_version,
getMemoryManager());
}
else
{
writeNumericCharacterReference(ch);
}
}
}
}
/**
* Escape and write a character in an attribute.
*/
void
writeDefaultAttributeEscape(XalanDOMChar ch)
{
assert(m_charPredicate.attribute(ch) == true);
if(writeDefaultAttributeEntity(ch) == false)
{
if(m_charPredicate.isForbidden(ch) == true)
{
throwInvalidXMLCharacterException(
ch,
m_version,
getMemoryManager());
}
else
{
writeNumericCharacterReference(ch);
}
}
}
/**
* Handle one of the default entities, return false if it
* is not a default entity.
*/
bool
writeDefaultEntity(XalanDOMChar ch)
{
if (XalanUnicode::charLessThanSign == ch)
{
m_writer.write(
m_constants.s_lessThanEntityString,
m_constants.s_lessThanEntityStringLength);
}
else if (XalanUnicode::charGreaterThanSign == ch)
{
m_writer.write(
m_constants.s_greaterThanEntityString,
m_constants.s_greaterThanEntityStringLength);
}
else if (XalanUnicode::charAmpersand == ch)
{
m_writer.write(
m_constants.s_ampersandEntityString,
m_constants.s_ampersandEntityStringLength);
}
else
{
return false;
}
return true;
}
/**
* Handle one of the default entities, return false if it
* is not a default entity.
*/
bool
writeDefaultAttributeEntity(XalanDOMChar ch)
{
if (writeDefaultEntity(ch) == true)
{
return true;
}
else if (XalanUnicode::charQuoteMark == ch)
{
m_writer.write(
m_constants.s_quoteEntityString,
m_constants.s_quoteEntityStringLength);
}
else
{
return false;
}
return true;
}
/**
* Check to see if a parent's ">" has been written, and, if
* it has not, write it.
*/
void
writeParentTagEnd()
{
if(markParentForChildren() == true)
{
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
m_indentHandler.setPrevText(false);
m_indentHandler.push_preserve();
}
}
/**
* Write a normalized character to the stream.
* @param ch the string to write.
* @param start the start offset into the string.
* @param length the length of the string.
*/
XalanDOMString::size_type
writeNormalizedChar(
XalanDOMChar ch,
const XalanDOMChar chars[],
XalanDOMString::size_type start,
XalanDOMString::size_type length)
{
if (XalanUnicode::charLF == ch)
{
outputNewline();
}
else
{
if(m_charPredicate.isCharRefForbidden(ch))
{
throwInvalidXMLCharacterException(
ch,
m_version,
getMemoryManager());
}
else
{
start = m_writer.write( chars, start, length);
}
}
return start;
}
void
writeNumericCharacterReference(unsigned long theNumber)
{
m_writer.write(value_type(XalanUnicode::charAmpersand));
m_writer.write(value_type(XalanUnicode::charNumberSign));
m_writer.write(UnsignedLongToDOMString(theNumber, m_stringBuffer));
clear(m_stringBuffer);
m_writer.write(value_type(XalanUnicode::charSemicolon));
}
XalanDOMString::size_type
writeNormalizedCharBig(
const XalanDOMChar chars[],
XalanDOMString::size_type start,
XalanDOMString::size_type length)
{
assert( start < length);
const XalanDOMChar ch = chars[start];
assert(m_charPredicate.range(ch) == true);
if (XMLVersion == XML_VERSION_1_1 &&
XalanUnicode::charLSEP == ch)
{
writeNumericCharacterReference(ch);
}
else
{
start = m_writer.write(chars, start, length);
}
return start;
}
/**
* Write characters for a CDATA section
*
* @param ch the string to write.
* @param length the length of the string.
*/
void
writeCDATAChars(
const XalanDOMChar chars[],
XalanDOMString::size_type length,
bool& outsideCDATA)
{
XalanDOMString::size_type i = 0;
while(i < length)
{
// If "]]>", which would close the CDATA appears in
// the content, we have to put the first two characters
// in the CDATA section, close the CDATA section, then
// open a new one and add the last character.
const XalanDOMChar theChar = chars[i];
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));
m_writer.write(
m_constants.s_cdataCloseString,
m_constants.s_cdataCloseStringLength);
m_writer.write(
m_constants.s_cdataOpenString,
m_constants.s_cdataOpenStringLength);
m_writer.write(value_type(XalanUnicode::charGreaterThanSign));
outsideCDATA = false;
i += 2;
}
else
{
if (XalanUnicode::charLF == theChar)
{
outputNewline();
}
else if(m_charPredicate.isCharRefForbidden(theChar))
{
throwInvalidXMLCharacterException(
theChar,
m_version,
getMemoryManager());
}
else
{
i = m_writer.writeCDATAChar(chars, i, length, outsideCDATA);
}
}
++i;
}
if(outsideCDATA == true)
{
m_writer.write(
m_constants.s_cdataOpenString,
m_constants.s_cdataOpenStringLength);
}
}
/**
* Write an attribute string.
*
* @param theString The string to write.
* @param theStringLength The length of the string.
*/
void
writeAttrString(
const XalanDOMChar* theString,
XalanDOMString::size_type theStringLength)
{
assert(theString != 0);
XalanDOMString::size_type i = 0;
XalanDOMString::size_type firstIndex = 0;
while(i < theStringLength)
{
const XalanDOMChar ch = theString[i];
if(m_charPredicate.range(ch) == true)
{
safeWriteContent(theString + firstIndex, i - firstIndex);
i = writeNormalizedCharBig(theString, i, theStringLength);
++i;
firstIndex = i;
}
else if (m_charPredicate.attribute(ch) == false)
{
++i;
}
else
{
safeWriteContent(theString + firstIndex, i - firstIndex);
writeDefaultAttributeEscape(ch);
++i;
firstIndex = i;
}
}
safeWriteContent(theString + firstIndex, i - firstIndex);
}
private:
/**
* Process an attribute.
* @param name The name of the attribute.
* @param value The value of the attribute.
*/
void
processAttribute(
const XalanDOMChar* name,
const XalanDOMChar* value)
{
m_writer.write(value_type(XalanUnicode::charSpace));
writeName(name);
m_writer.write(value_type(XalanUnicode::charEqualsSign));
m_writer.write(value_type(XalanUnicode::charQuoteMark));
writeAttrString(value, length(value));
m_writer.write(value_type(XalanUnicode::charQuoteMark));
}
/**
* Write normalized data.
* @param theData the data to write.
* @param theLength the data to write.
*/
void
writeNormalizedData(
const XalanDOMChar* theData,
XalanDOMString::size_type theLength)
{
for (XalanDOMString::size_type i = 0; i < theLength; ++i)
{
const XalanDOMChar theChar = theData[i];
i = writeNormalizedChar(theChar, theData, i, theLength);
}
}
void
safeWriteContent(
const XalanDOMChar* theChars,
XalanDOMString::size_type theLength)
{
for(size_type i = 0; i < theLength; ++i)
{
m_writer.write(value_type(theChars[i]));
}
}
void
writeName(const XalanDOMChar* theChars)
{
assert( theChars != 0);
m_writer.writeNameChar(theChars, length(theChars));
}
private:
// These are not implemented.
FormatterToXMLUnicode(const FormatterToXMLUnicode&);
FormatterToXMLUnicode&
operator=(const FormatterToXMLUnicode&);
bool
operator==(const FormatterToXMLUnicode&) const;
// Data members...
XalanDOMString m_stringBuffer;
UnicodeWriter m_writer;
ConstantsType m_constants;
CharPredicate m_charPredicate;
IndentHandler m_indentHandler;
};
XALAN_CPP_NAMESPACE_END
#endif // FORMATTERTOXML_UNICODE_HEADER_GUARD_1357924680
Index: FormatterToText.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/FormatterToText.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** FormatterToText.hpp 8 Apr 2004 07:56:57 -0000 1.1.1.1
--- FormatterToText.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(FORMATTERTOTEXT_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(FORMATTERTOTEXT_HEADER_GUARD_1357924680)
***************
*** 93,97 ****
* FormatterToText instance constructor.
*/
! FormatterToText();
/**
--- 52,56 ----
* FormatterToText instance constructor.
*/
! FormatterToText(MemoryManagerType& theManager XALAN_DEFAULT_CONSTRACTOR_MEMORY_MGR);
/**
***************
*** 103,109 ****
*/
FormatterToText(
! Writer& writer,
! bool normalizeLinefeed = true,
! bool handleIgnorableWhitespace = true);
/**
--- 62,69 ----
*/
FormatterToText(
! Writer& writer,
! bool normalizeLinefeed = true,
! bool handleIgnorableWhitespace = true,
! MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
/**
***************
*** 119,122 ****
--- 79,91 ----
const XalanDOMString& encoding,
bool normalizeLinefeed = true,
+ bool handleIgnorableWhitespace = true,
+ MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+
+ static FormatterToText*
+ create(
+ MemoryManagerType& theManager,
+ Writer& writer,
+ const XalanDOMString& encoding,
+ bool normalizeLinefeed = true,
bool handleIgnorableWhitespace = true);
***************
*** 124,127 ****
--- 93,101 ----
~FormatterToText();
+ MemoryManagerType&
+ getMemoryManager()
+ {
+ return m_encoding.getMemoryManager();
+ }
Writer*
Index: FormatterToDOM.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/FormatterToDOM.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** FormatterToDOM.hpp 8 Apr 2004 07:56:55 -0000 1.1.1.1
--- FormatterToDOM.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(FORMATTERTODOM_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(FORMATTERTODOM_HEADER_GUARD_1357924680)
***************
*** 65,69 ****
! #include <vector>
--- 24,28 ----
! #include <xalanc/Include/XalanVector.hpp>
***************
*** 92,95 ****
--- 51,56 ----
* This class takes SAX events (in addition to some extra events that SAX
* doesn't handle yet) and adds the result to a document or document fragment.
+ *
+ * This class is deprecated and will be removed!!!!
*/
class XALAN_XMLSUPPORT_EXPORT FormatterToDOM : public FormatterListener
***************
*** 97,105 ****
public:
! #if defined(XALAN_NO_STD_NAMESPACE)
! typedef vector<XalanElement*> ElementStackType;
! #else
! typedef std::vector<XalanElement*> ElementStackType;
! #endif
/**
--- 58,62 ----
public:
! typedef XalanVector<XalanElement*> ElementStackType;
/**
***************
*** 114,118 ****
XalanDocument* doc,
XalanDocumentFragment* docFrag,
! XalanElement* currentElement);
/**
--- 71,76 ----
XalanDocument* doc,
XalanDocumentFragment* docFrag,
! XalanElement* currentElement,
! MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
/**
***************
*** 124,129 ****
*/
FormatterToDOM(
! XalanDocument* doc,
! XalanElement* elem);
virtual
--- 82,88 ----
*/
FormatterToDOM(
! XalanDocument* doc,
! XalanElement* elem,
! MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
virtual
--- NEW FILE: XalanFormatterWriter.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANFORMATTERWRITER_HEADER_GUARD_1357924680)
#define XALANFORMATTERWRITER_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xalanc/PlatformSupport/DOMStringHelper.hpp>
#include <xalanc/PlatformSupport/Writer.hpp>
#include <xalanc/PlatformSupport/XalanMessageLoader.hpp>
#include <xalanc/PlatformSupport/XalanOutputStream.hpp>
XALAN_CPP_NAMESPACE_BEGIN
XALAN_USING_XERCES(MemoryManager)
class XalanFormatterWriter
{
public:
template <class WriterType>
class NewLineWriterFunctor
{
public:
typedef WriterType writer_type;
NewLineWriterFunctor(WriterType& writer) :
m_writer(writer),
m_newlineString(0),
m_newlineStringLength(0)
{
XalanOutputStream* stream = writer.getStream();
if(stream != 0)
{
m_newlineString = stream->getNewlineString();
}
else
{
m_newlineString = XalanOutputStream::defaultNewlineString();
}
assert(m_newlineString != 0);
m_newlineStringLength = length(m_newlineString);
}
void
operator()()
{
assert(m_newlineString != 0 && length(m_newlineString) == m_newlineStringLength);
m_writer.write(m_newlineString, m_newlineStringLength);
}
private:
WriterType& m_writer;
/**
* The string of characters that represents the newline
*/
const XalanDOMChar* m_newlineString;
/**
* The length of the the string of characters that represents the newline
*/
XalanDOMString::size_type m_newlineStringLength;
};
template<class WriterType>
class WhiteSpaceWriterFunctor
{
typedef XalanDOMString::size_type size_type;
typedef typename WriterType::value_type value_type;
public:
typedef WriterType writer_type;
WhiteSpaceWriterFunctor(WriterType& writer) :
m_writer(writer)
{
}
void
operator()(size_type count)
{
for ( size_type i = 0 ; i < count ; i++ )
{
m_writer.write(value_type(XalanUnicode::charSpace));
}
}
private:
WriterType& m_writer;
};
class CommonRepresentableCharFunctor
{
public:
CommonRepresentableCharFunctor(const XalanOutputStream* stream) :
m_stream(stream)
{
assert(stream != 0);
}
bool
operator()(unsigned int theChar) const
{
bool result = true;
if( m_stream != 0)
{
result = m_stream->canTranscodeTo(theChar);
}
return result;
}
private:
const XalanOutputStream* const m_stream;
};
public:
typedef XalanDOMString::size_type size_type;
XalanFormatterWriter(
Writer& theWriter,
MemoryManager& theMemoryManager) :
m_writer(theWriter),
m_memoryManager(theMemoryManager),
m_stringBuffer(5, 0, theMemoryManager)
{
const XalanOutputStream* const theStream =
theWriter.getStream();
if (theStream == 0)
{
m_newlineString = XalanOutputStream::defaultNewlineString();
}
else
{
m_newlineString = theStream->getNewlineString();
}
assert(m_newlineString != 0);
m_newlineStringLength = length(m_newlineString);
assert(m_newlineString != 0);
}
MemoryManagerType&
getMemoryManager()
{
return m_memoryManager;
}
virtual
~XalanFormatterWriter()
{
}
Writer*
getWriter() const
{
return &m_writer;
}
XalanOutputStream*
getStream()
{
return m_writer.getStream();
}
const XalanOutputStream*
getStream() const
{
return m_writer.getStream();
}
void
flushWriter()
{
m_writer.flush();
}
static bool
isUTF16HighSurrogate(XalanDOMChar theChar)
{
return 0xD800u <= theChar && theChar <= 0xDBFFu ? true : false;
}
static bool
isUTF16LowSurrogate(XalanDOMChar theChar)
{
return 0xDC00u <= theChar && theChar <= 0xDFFFu ? true : false;
}
static unsigned int
decodeUTF16SurrogatePair(
XalanDOMChar theHighSurrogate,
XalanDOMChar theLowSurrogate,
MemoryManager& theManager)
{
assert(isUTF16HighSurrogate(theHighSurrogate) == true);
if (isUTF16LowSurrogate(theLowSurrogate) == false)
{
throwInvalidUTF16SurrogateException(theHighSurrogate, theLowSurrogate, theManager);
}
return ((theHighSurrogate - 0xD800u) << 10) + theLowSurrogate - 0xDC00u + 0x00010000u;
}
static void
throwInvalidCharacterException(
unsigned int ch,
MemoryManager& theManager)
{
XalanDOMString theMessage(theManager);
XalanDOMString theBuffer(theManager);
XalanMessageLoader::getMessage(
theMessage,
XalanMessages::InvalidScalar_1Param,
UnsignedLongToHexDOMString(ch, theBuffer));
XALAN_USING_XERCES(SAXException)
throw SAXException(c_wstr(theMessage), &theManager);
}
static void
throwInvalidUTF16SurrogateException(
XalanDOMChar ch,
XalanDOMChar next,
MemoryManagerType& theManager)
{
XalanDOMString chStr(theManager);
XalanDOMString nextStr(theManager);
UnsignedLongToHexDOMString(ch, chStr);
UnsignedLongToHexDOMString(next, nextStr);
XalanDOMString theMessage(theManager);
XalanMessageLoader::getMessage(
theMessage,
XalanMessages::InvalidSurrogatePair_2Param,
theMessage,
chStr,
nextStr);
XALAN_USING_XERCES(SAXException)
throw SAXException(c_wstr(theMessage),&theManager);
}
protected:
/**
* The writer.
*/
Writer& m_writer;
/**
* The MemoryManager instance to use for any dynamically-
* allocated memory.
*/
MemoryManager& m_memoryManager;
XalanDOMString m_stringBuffer;
/**
* The string of characters that represents the newline
*/
const XalanDOMChar* m_newlineString;
/**
* The length of the the string of characters that represents the newline
*/
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.
XalanFormatterWriter();
XalanFormatterWriter&
operator=(const XalanFormatterWriter&);
};
XALAN_CPP_NAMESPACE_END
#endif // XALANFORMATTERWRITER_HEADER_GUARD_1357924680
--- NEW FILE: XalanOtherEncodingWriter.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680)
#define XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680
#include <xalanc/XMLSupport/XalanFormatterWriter.hpp>
XALAN_CPP_NAMESPACE_BEGIN
template <class Predicate,
class ConstantsType>
class XalanOtherEncodingWriter : public XalanFormatterWriter
{
public:
typedef XalanOtherEncodingWriter<Predicate, ConstantsType> ThisType;
class WriteCharRef
{
public:
WriteCharRef(ThisType& writer) :
m_writer(writer)
{
}
void
operator()(unsigned int value) const
{
m_writer.writeNumericCharacterReference(value);
}
private:
ThisType& m_writer;
};
class ThrowTranscodingException
{
public:
ThrowTranscodingException(ThisType& writer) :
m_writer(writer)
{
}
void
operator()(unsigned int value) const
{
m_writer.throwInvalidCharacterException(value, m_writer.getMemoryManager());
}
private:
ThisType& m_writer;
};
friend class WriteCharRef;
friend class ThrowTranscodingException;
typedef XalanDOMChar value_type;
XalanOtherEncodingWriter(
Writer& writer,
MemoryManager& theMemoryManager) :
XalanFormatterWriter(
writer,
theMemoryManager),
m_buffer(),
m_bufferPosition(m_buffer),
m_bufferRemaining(kBufferSize),
m_predicate(writer.getStream()),
m_constants(),
m_charRefFunctor(*this),
m_exceptionFunctor(*this)
{
}
virtual
~XalanOtherEncodingWriter()
{
}
/**
* Output a line break.
*/
void
outputNewline()
{
assert(m_newlineString != 0);
assert(length(m_newlineString) == m_newlineStringLength);
write(
m_newlineString,
m_newlineStringLength);
}
/**
* Writes CDATA chars , if not presentable, fixes it
* with addition CDATA sections
*/
size_type
writeCDATAChar(
const XalanDOMChar chars[],
size_type start,
size_type length,
bool& outsideCDATA)
{
assert(chars != 0 && length > 0 && start < length);
const XalanDOMChar theChar = chars[start];
unsigned int value = theChar;
size_type result = start;
if (isUTF16HighSurrogate(theChar) == true)
{
if (start + 1 >= length)
{
throwInvalidUTF16SurrogateException(
theChar,
0,
getMemoryManager());
}
else
{
value = decodeUTF16SurrogatePair(theChar, chars[start+1], getMemoryManager());
++result;
}
}
if(m_predicate(value))
{
if (outsideCDATA == false)
{
// We have a representable char in the normal state,
// so just print it.
write(value);
}
else
{
// 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);
outsideCDATA = false;
}
}
else
{
if(outsideCDATA == false)
{
// 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);
writeNumericCharacterReference(value);
outsideCDATA = true;
}
else
{
writeNumericCharacterReference(value);
}
}
return result;
}
/**
* Writes name characters. If a character is not representable,
* an exception is thrown.
*/
void
writeNameChar(
const XalanDOMChar* data,
size_type theLength)
{
for( size_type i = 0; i < theLength; ++i)
{
i = write(data, i , theLength, m_exceptionFunctor);
}
}
/**
* Writes PI characters. If a character is not representable,
* an exception is thrown.
*/
void
writePIChars(
const XalanDOMChar* data,
size_type theLength)
{
for( size_type i = 0; i < theLength; )
{
i = write(data, i , theLength, m_exceptionFunctor);
}
}
/**
* 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)
{
for( size_type i = 0; i < theLength; )
{
i = write(data, i , theLength, m_exceptionFunctor);
}
}
void
write(
const XalanDOMChar* theChars,
size_type theLength)
{
for(size_type i = 0; i < theLength; ++i)
{
write(theChars[i]);
}
}
void
write(const XalanDOMString& theChars)
{
write(theChars.c_str(), theChars.length());
}
/**
* 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_predicate(theChar))
{
*m_bufferPosition = theChar;
++m_bufferPosition;
--m_bufferRemaining;
}
else
{
writeNumericCharacterReference(theChar);
}
}
size_type
write(
const XalanDOMChar chars[],
size_type start,
size_type length)
{
return write(chars, start, length, m_charRefFunctor);
}
void
writeSafe(
const XalanDOMChar* theChars,
size_type theLength)
{
for(size_type i = 0; i < theLength; ++i)
{
const XalanDOMChar ch = theChars[i];
if (isUTF16HighSurrogate(ch) == true)
{
if (i + 1 >= theLength)
{
throwInvalidUTF16SurrogateException(ch, 0, getMemoryManager());
}
else
{
unsigned int value = decodeUTF16SurrogatePair(ch, theChars[i+1], getMemoryManager());
if(this->m_isPresentable(value))
{
write(value);
}
else
{
this->writeNumberedEntityReference(value);
}
++i;
}
}
else
{
write((unsigned int)ch);
}
}
}
void
write(const XalanDOMChar* theChars)
{
write(theChars, XalanDOMString::length(theChars));
}
void
flushWriter()
{
m_writer.flush();
}
void
flushBuffer()
{
m_writer.write(m_buffer, 0, m_bufferPosition - m_buffer);
m_bufferPosition = m_buffer;
m_bufferRemaining = kBufferSize;
}
private:
/**
* Writes a representable code point
*
* @param chars Array of the characters for transcoding
*
* @param start Place int the array the transcoding should start
*
* @param length The length of the array
*
* @param failureHandler The functor handles the non-representable characters
*
* @return Place int the array of the next character
*/
template <class TranscodingFailureFunctor>
size_type
write(
const XalanDOMChar chars[],
size_type start,
size_type length,
TranscodingFailureFunctor& failureHandler)
{
assert(chars != 0 && length > 0);
assert(start <= length);
size_type result = start;
const XalanDOMChar ch = chars[start];
unsigned int value = ch;
if (XalanFormatterWriter::isUTF16HighSurrogate(ch) == true)
{
if (start + 1 >= length)
{
throwInvalidUTF16SurrogateException(
ch,
0,
getMemoryManager());
}
else
{
value = decodeUTF16SurrogatePair(ch, chars[start+1], getMemoryManager());
++result;
}
}
if(m_predicate(value))
{
write(value);
}
else
{
failureHandler(value);
}
return result;
}
/**
* 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
*/
void
write(unsigned int theChar)
{
// encode back UTF-32 into UTF-16
if( theChar > 0xFFFF )
{
if (m_bufferRemaining < 2)
{
flushBuffer();
}
*m_bufferPosition = (XalanDOMChar((theChar >> 10) + 0xD7C0));
++m_bufferPosition;
*m_bufferPosition = (XalanDOMChar((theChar & 0x03FF) + 0xDC00));
++m_bufferPosition;
m_bufferRemaining = m_bufferRemaining - size_type(2);
}
else
{
if (m_bufferRemaining == 0)
{
flushBuffer();
}
*m_bufferPosition = XalanDOMChar(theChar);
++m_bufferPosition;
--m_bufferRemaining;
}
}
void
writeNumericCharacterReference(unsigned int theNumber)
{
write(formatNumericCharacterReference(theNumber));
}
enum
{
kBufferSize = 512u // The size of the buffer
};
// Data members...
XalanDOMChar m_buffer[kBufferSize];
XalanDOMChar* m_bufferPosition;
size_type m_bufferRemaining;
const Predicate m_predicate;
const ConstantsType m_constants;
const WriteCharRef m_charRefFunctor;
const ThrowTranscodingException m_exceptionFunctor;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANUNICODESUBSETWRITER_HEADER_GUARD_1357924680
Index: FormatterTreeWalker.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/FormatterTreeWalker.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** FormatterTreeWalker.hpp 8 Apr 2004 07:56:59 -0000 1.1.1.1
--- FormatterTreeWalker.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(FORMATTERTREEWALKER_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(FORMATTERTREEWALKER_HEADER_GUARD_1357924680)
***************
*** 63,67 ****
#include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
!
#include <xalanc/DOMSupport/TreeWalker.hpp>
--- 22,26 ----
#include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
! #include <xalanc/Include/XalanMemoryManagement.hpp>
#include <xalanc/DOMSupport/TreeWalker.hpp>
***************
*** 87,91 ****
* (toXMLString, digest, ...)
*/
! FormatterTreeWalker(FormatterListener& formatterListener);
virtual
--- 46,51 ----
* (toXMLString, digest, ...)
*/
! FormatterTreeWalker(FormatterListener& formatterListener,
! MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
virtual
***************
*** 109,112 ****
--- 69,74 ----
FormatterListener& m_formatterListener;
+
+ MemoryManagerType& m_memoryManager;
};
--- NEW FILE: XalanXMLSerializerBase.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANXMLSERIALIZERBASE_HEADER_GUARD_1357924680)
#define XALANXMLSERIALIZERBASE_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include "xalanc/XMLSupport/XMLSupportDefinitions.hpp"
#include "xalanc/Include/XalanVector.hpp"
#include "xalanc/XalanDOM/XalanDOMString.hpp"
// Base class header file.
#include "xalanc/PlatformSupport/FormatterListener.hpp"
XALAN_CPP_NAMESPACE_BEGIN
class XalanOutputStream;
XALAN_USING_XERCES(MemoryManager)
/**
* XalanXMLSerializerBase serves as a base class for XML serializers based on
* FormatterListener events.
*/
class XALAN_XMLSUPPORT_EXPORT XalanXMLSerializerBase : public FormatterListener
{
public:
/**
* Perform static initialization. See class XMLSupportInit.
*/
static void
initialize(MemoryManager& theManager);
/**
* Perform static shut down. See class XMLSupportInit.
*/
static void
terminate();
/**
* Constructor
*
* @param theManager The MemoryManager instance to use for any memory
* allocations
* @param doctypeSystem system identifier to be used in the document
* type declaration
* @param doctypePublic public identifier to be used in the document
* type declaration
* @param xmlDecl true if the XSLT processor should output an XML
* declaration
* @param theStandalone The string the XSLT processor should output for
* the standalone document declaration
*/
XalanXMLSerializerBase(
MemoryManager& theManager,
eXMLVersion theXMLVersion,
const XalanDOMString& theEncoding,
const XalanDOMString& theDoctypeSystem,
const XalanDOMString& theDoctypePublic,
bool xmlDecl,
const XalanDOMString& theStandalone);
virtual
~XalanXMLSerializerBase();
MemoryManagerType&
getMemoryManager()
{
return m_elemStack.getMemoryManager();
}
// These methods are inherited from FormatterListener ...
virtual void
setDocumentLocator(const Locator* const locator);
virtual void
startDocument();
virtual void
startElement(
const XMLCh* const name,
AttributeList& attrs) = 0;
virtual void
endElement(const XMLCh* const name) = 0;
virtual void
characters(
const XMLCh* const chars,
const unsigned int length);
virtual void
charactersRaw(
const XMLCh* const chars,
const unsigned int length) = 0;
virtual void
entityReference(const XMLCh* const name) = 0;
virtual void
ignorableWhitespace(
const XMLCh* const chars,
const unsigned int length);
virtual void
processingInstruction(
const XMLCh* const target,
const XMLCh* const data);
virtual void
resetDocument();
virtual void
comment(const XMLCh* const data) = 0;
virtual void
cdata(
const XMLCh* const ch,
const unsigned int length);
virtual const XalanDOMString&
getDoctypeSystem() const;
virtual const XalanDOMString&
getDoctypePublic() const;
virtual const XalanDOMString&
getEncoding() const = 0;
const XalanDOMString&
getVersion() const
{
return m_version;
}
const XalanDOMString&
getStandalone() const
{
return m_standalone;
}
bool
getShouldWriteXMLHeader() const
{
return m_shouldWriteXMLHeader;
}
void
setShouldWriteXMLHeader(bool b)
{
m_shouldWriteXMLHeader = b;
}
typedef XalanVector<bool> BoolStackType;
static const XalanDOMString& s_1_0String;
static const XalanDOMString& s_1_1String;
class XALAN_XMLSUPPORT_EXPORT UTF8
{
public:
// Static data members...
/**
* The string "UTF-8".
*/
static const XalanDOMString& s_encodingString;
/**
* The string "<!DOCTYPE ".
*/
static const char s_doctypeHeaderStartString[];
static const XalanDOMString::size_type s_doctypeHeaderStartStringLength;
/**
* The string " PUBLIC \"".
*/
static const char s_doctypeHeaderPublicString[];
static const XalanDOMString::size_type s_doctypeHeaderPublicStringLength;
/**
* The string " SYSTEM \"".
*/
static const char s_doctypeHeaderSystemString[];
static const XalanDOMString::size_type s_doctypeHeaderSystemStringLength;
/**
* The string "<?xml version=\"".
*/
static const char s_xmlHeaderStartString[];
static const XalanDOMString::size_type s_xmlHeaderStartStringLength;
/**
* The string "\" encoding=\"".
*/
static const char s_xmlHeaderEncodingString[];
static const XalanDOMString::size_type s_xmlHeaderEncodingStringLength;
/**
* The string "\" standalone=\"".
*/
static const char s_xmlHeaderStandaloneString[];
static const XalanDOMString::size_type s_xmlHeaderStandaloneStringLength;
/**
* The string "\"?>".
*/
static const char s_xmlHeaderEndString[];
static const XalanDOMString::size_type s_xmlHeaderEndStringLength;
/**
* The string "1.0".
*/
static const char s_defaultVersionString[];
static const XalanDOMString::size_type s_defaultVersionStringLength;
/**
* The string "-//W3C//DTD XHTML".
*/
static const XalanDOMChar s_xhtmlDocTypeString[];
static const XalanDOMString::size_type s_xhtmlDocTypeStringLength;
/**
* The string "<![CDATA[".
*/
static const char s_cdataOpenString[];
static const XalanDOMString::size_type s_cdataOpenStringLength;
/**
* The string "]]>".
*/
static const char s_cdataCloseString[];
static const XalanDOMString::size_type s_cdataCloseStringLength;
/**
* The string "<".
*/
static const char s_lessThanEntityString[];
static const XalanDOMString::size_type s_lessThanEntityStringLength;
/**
* The string ">".
*/
static const char s_greaterThanEntityString[];
static const XalanDOMString::size_type s_greaterThanEntityStringLength;
/**
* The string "&".
*/
static const char s_ampersandEntityString[];
static const XalanDOMString::size_type s_ampersandEntityStringLength;
/**
* The string """.
*/
static const char s_quoteEntityString[];
static const XalanDOMString::size_type s_quoteEntityStringLength;
};
class XALAN_XMLSUPPORT_EXPORT UTF16
{
public:
/**
* The string "UTF-16".
*/
static const XalanDOMString& s_encodingString;
/**
* The string "<!DOCTYPE ".
*/
static const XalanDOMChar s_doctypeHeaderStartString[];
static const XalanDOMString::size_type s_doctypeHeaderStartStringLength;
/**
* The string " PUBLIC \"".
*/
static const XalanDOMChar s_doctypeHeaderPublicString[];
static const XalanDOMString::size_type s_doctypeHeaderPublicStringLength;
/**
* The string " SYSTEM \"".
*/
static const XalanDOMChar s_doctypeHeaderSystemString[];
static const XalanDOMString::size_type s_doctypeHeaderSystemStringLength;
/**
* The string "<?xml version=\"".
*/
static const XalanDOMChar s_xmlHeaderStartString[];
static const XalanDOMString::size_type s_xmlHeaderStartStringLength;
/**
* The string "\" encoding=\"".
*/
static const XalanDOMChar s_xmlHeaderEncodingString[];
static const XalanDOMString::size_type s_xmlHeaderEncodingStringLength;
/**
* The string "\" standalone=\"".
*/
static const XalanDOMChar s_xmlHeaderStandaloneString[];
static const XalanDOMString::size_type s_xmlHeaderStandaloneStringLength;
/**
* The string "\"?>".
*/
static const XalanDOMChar s_xmlHeaderEndString[];
static const XalanDOMString::size_type s_xmlHeaderEndStringLength;
/**
* The string "1.0".
*/
static const XalanDOMChar s_defaultVersionString[];
static const XalanDOMString::size_type s_defaultVersionStringLength;
/**
* The string "-//W3C//DTD XHTML".
*/
static const XalanDOMChar s_xhtmlDocTypeString[];
static const XalanDOMString::size_type s_xhtmlDocTypeStringLength;
/**
* The string "<![CDATA[".
*/
static const XalanDOMChar s_cdataOpenString[];
static const XalanDOMString::size_type s_cdataOpenStringLength;
/**
* The string "]]>".
*/
static const XalanDOMChar s_cdataCloseString[];
static const XalanDOMString::size_type s_cdataCloseStringLength;
/**
* The string "<".
*/
static const XalanDOMChar s_lessThanEntityString[];
static const XalanDOMString::size_type s_lessThanEntityStringLength;
/**
* The string ">".
*/
static const XalanDOMChar s_greaterThanEntityString[];
static const XalanDOMString::size_type s_greaterThanEntityStringLength;
/**
* The string "&".
*/
static const XalanDOMChar s_ampersandEntityString[];
static const XalanDOMString::size_type s_ampersandEntityStringLength;
/**
* The string """.
*/
static const XalanDOMChar s_quoteEntityString[];
static const XalanDOMString::size_type s_quoteEntityStringLength;
};
enum
{
eBufferSize = 512 // The size of the buffer
};
class XALAN_XMLSUPPORT_EXPORT CharFunctor1_0
{
public:
bool
attribute(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] > eNone;
}
bool
content(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] > eAttr;
}
bool
range(XalanDOMChar theChar) const
{
assert(theChar > 0);
return theChar > s_lastSpecial;
}
bool
isForbidden(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] == eForb;
}
bool
isCharRefForbidden(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] == eForb;
}
private:
static const size_t s_lastSpecial;
static const char s_specialChars[];
};
class XALAN_XMLSUPPORT_EXPORT CharFunctor1_1
{
public:
bool
attribute(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] > eNone;
}
bool
content(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] > eAttr;
}
bool
range(XalanDOMChar theChar) const
{
assert(theChar > 0);
return theChar > s_lastSpecial;
}
bool
isForbidden(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] == eForb;
}
bool
isCharRefForbidden(XalanDOMChar theChar) const
{
return theChar > s_lastSpecial ?
false :
s_specialChars[theChar] == eCRFb;
}
private:
static const size_t s_lastSpecial;
static const char s_specialChars[];
};
enum
{
eNone = 0u,
eAttr = 1u, // A flag to indicate a value in s_specialChars applies to attributes
eBoth = 2u, // A flag to indicate a value in s_specialChars applies to both content and attributes
eForb = 4u, // A flag to indicate a forbidden value in s_specialChars
// XML1.1 put a requirement to output chars #x1...#x1F and #x7F...#x9F as charRefs only
// In the comments , PI and CDATA usage of charRefs is forbidden, so we will report an error in
eCRFb = 5u // that case. For the elemets and attributes is should work the same as eBoth
};
protected:
virtual void
writeXMLHeader() = 0;
virtual void
flushBuffer() = 0;
virtual void
writeDoctypeDecl(const XalanDOMChar* name) = 0;
virtual void
writeProcessingInstruction(
const XMLCh* target,
const XMLCh* data) = 0;
virtual void
writeCharacters(
const XMLCh* chars,
unsigned int length) = 0;
virtual void
writeCDATA(
const XMLCh* chars,
unsigned int length) = 0;
virtual void
outputNewline() = 0;
/**
* Mark the parent element as having a child. If this
* is the first child, return true, otherwise, return
* false. This allows the child element to determine
* if the parent tag has already been closed.
*
* @return true if the parent element has not been previously marked for children.
*/
bool
markParentForChildren()
{
if(!m_elemStack.empty())
{
// See if the parent element has already been flagged as having children.
if(false == m_elemStack.back())
{
m_elemStack.back() = true;
return true;
}
}
return false;
}
/**
* Determine if it a DOCTYPE declaration needs to
* be written.
*/
bool
getNeedToOutputDoctypeDecl() const
{
return m_needToOutputDoctypeDecl;
}
/**
* Open an element for possibile children
*/
void
openElementForChildren()
{
m_elemStack.push_back(false);
}
bool
outsideDocumentElement() const
{
return m_elemStack.empty();
}
/**
* Determine if an element ever had any children added.
*
* @return true if the children were added, false if not.
*/
bool
childNodesWereAdded()
{
bool fResult = false;
if (m_elemStack.empty() == false)
{
fResult = m_elemStack.back();
m_elemStack.pop_back();
}
return fResult;
}
void
generateDoctypeDecl(const XalanDOMChar* name)
{
if(true == m_needToOutputDoctypeDecl)
{
assert(m_doctypeSystem.empty() == false);
writeDoctypeDecl(name);
m_needToOutputDoctypeDecl = false;
}
}
/**
* Tell if the next text should be raw.
*/
bool m_nextIsRaw;
/**
* Add space before '/>' for XHTML.
*/
bool m_spaceBeforeClose;
/**
* The System ID for the doc type.
*/
const XalanDOMString m_doctypeSystem;
/**
* The public ID for the doc type.
*/
const XalanDOMString m_doctypePublic;
/**
* Tells the XML version, for writing out to the XML decl.
*/
const XalanDOMString& m_version;
/**
* Text for standalone part of header.
*/
const XalanDOMString m_standalone;
const XalanDOMString m_encoding;
static bool
isUTF16HighSurrogate(XalanDOMChar theChar)
{
return 0xD800u <= theChar && theChar <= 0xDBFFu ? true : false;
}
static bool
isUTF16LowSurrogate(XalanDOMChar theChar)
{
return 0xDC00u <= theChar && theChar <= 0xDFFFu ? true : false;
}
static unsigned int
decodeUTF16SurrogatePair(
XalanDOMChar theHighSurrogate,
XalanDOMChar theLowSurrogate,
MemoryManager& theManager);
/**
* Throw an exception when an invalid
* surrogate is encountered.
* @param ch The first character in the surrogate
*/
static void
throwInvalidUTF16SurrogateException(
XalanDOMChar ch,
MemoryManager& theManager);
/**
* Throw an exception when an invalid
* surrogate is encountered.
* @param ch The first character in the surrogate
* @param next The next character in the surrogate
*/
static void
throwInvalidUTF16SurrogateException(
XalanDOMChar ch,
XalanDOMChar next,
MemoryManager& theManager);
/**
* Throw an exception when an invalid
* character is encountered.
* @param ch The first character in the surrogate
* @param next The next character in the surrogate
*/
static void
throwInvalidCharacterException(
unsigned int ch,
MemoryManager& theManager);
/**
* Throw an exception when an invalid
* character for the specific XML version is encountered.
* @param ch The first character in the surrogate
* @param next The next character in the surrogate
*/
static void
throwInvalidXMLCharacterException(
unsigned int ch,
const XalanDOMString& theXMLversion,
MemoryManager& theManager);
private:
// These are not implemented.
XalanXMLSerializerBase(const XalanXMLSerializerBase&);
XalanXMLSerializerBase&
operator=(const XalanXMLSerializerBase&);
bool
operator==(const XalanXMLSerializerBase&) const;
// Data members...
/**
* Flag to tell that we need to add the doctype decl,
* which we can't do until the first element is
* encountered.
*/
bool m_needToOutputDoctypeDecl;
/**
* If true, XML header should be written to output.
*/
bool m_shouldWriteXMLHeader;
/**
* A stack of Boolean objects that tell if the given element
* has children.
*/
BoolStackType m_elemStack;
/**
* The string "-//W3C//DTD XHTML".
*/
static const XalanDOMChar s_xhtmlDocTypeString[];
static const XalanDOMString::size_type s_xhtmlDocTypeStringLength;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANXMLSERIALIZERBASE_HEADER_GUARD_1357924680
Index: FormatterToHTML.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/FormatterToHTML.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** FormatterToHTML.hpp 8 Apr 2004 07:56:56 -0000 1.1.1.1
--- FormatterToHTML.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(FORMATTERTOHTML_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(FORMATTERTOHTML_HEADER_GUARD_1357924680)
***************
*** 65,69 ****
! #include <vector>
--- 24,28 ----
! #include <xalanc/Include/XalanVector.hpp>
***************
*** 91,101 ****
class XALAN_XMLSUPPORT_EXPORT FormatterToHTML : public FormatterToXML
{
public:
! #if defined(XALAN_NO_STD_NAMESPACE)
! typedef vector<XalanHTMLElementsProperties::ElementProperties> ElementPropertiesStackType;
! #else
! typedef std::vector<XalanHTMLElementsProperties::ElementProperties> ElementPropertiesStackType;
! #endif
enum
--- 50,59 ----
class XALAN_XMLSUPPORT_EXPORT FormatterToHTML : public FormatterToXML
{
+
public:
!
! typedef XalanVector<XalanHTMLElementsProperties::ElementProperties> ElementPropertiesStackType;
!
enum
***************
*** 117,129 ****
FormatterToHTML(
Writer& writer,
! const XalanDOMString& encoding = XalanDOMString(),
! const XalanDOMString& mediaType = XalanDOMString(),
! const XalanDOMString& doctypeSystem = XalanDOMString(),
! const XalanDOMString& doctypePublic = XalanDOMString(),
bool doIndent = true,
int indent = eDefaultIndentAmount,
bool escapeURLs = true,
! bool omitMetaTag = false);
virtual
~FormatterToHTML();
--- 75,100 ----
FormatterToHTML(
Writer& writer,
! const XalanDOMString& encoding = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
! const XalanDOMString& mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
! const XalanDOMString& doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
! const XalanDOMString& doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
bool doIndent = true,
int indent = eDefaultIndentAmount,
bool escapeURLs = true,
! bool omitMetaTag = false,
! MemoryManagerType& theManager XALAN_DEFAULT_MEMMGR);
+ static FormatterToHTML*
+ create(
+ MemoryManagerType& theManager,
+ Writer& writer,
+ const XalanDOMString& encoding,
+ const XalanDOMString& mediaType,
+ const XalanDOMString& doctypeSystem,
+ const XalanDOMString& doctypePublic,
+ bool doIndent,
+ int indent,
+ bool escapeURLs,
+ bool omitMetaTag);
virtual
~FormatterToHTML();
Index: XalanHTMLElementsProperties.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/XalanHTMLElementsProperties.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XalanHTMLElementsProperties.hpp 8 Apr 2004 07:56:59 -0000 1.1.1.1
--- XalanHTMLElementsProperties.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(XALANHTMLELEMENTSPROPERTIES_HEADER_GUARD_1357924680)
Index: FormatterToNull.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/FormatterToNull.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** FormatterToNull.hpp 8 Apr 2004 07:56:57 -0000 1.1.1.1
--- FormatterToNull.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(FORMATTERTONULL_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(FORMATTERTONULL_HEADER_GUARD_1357924680)
Index: XMLParserLiaison.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/XMLParserLiaison.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XMLParserLiaison.hpp 8 Apr 2004 07:56:59 -0000 1.1.1.1
--- XMLParserLiaison.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(XMLPARSERLIAISON_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(XMLPARSERLIAISON_HEADER_GUARD_1357924680)
***************
*** 95,98 ****
--- 54,58 ----
class XALAN_XMLSUPPORT_EXPORT XMLParserLiaison
{
+
public:
***************
*** 112,115 ****
--- 72,78 ----
getExecutionContext() const = 0;
+ virtual MemoryManagerType&
+ getMemoryManager() = 0;
+
virtual void
setExecutionContext(ExecutionContext& theContext) = 0;
***************
*** 134,138 ****
parseXMLStream(
const InputSourceType& inputSource,
! const XalanDOMString& identifier = XalanDOMString()) = 0;
/**
--- 97,101 ----
parseXMLStream(
const InputSourceType& inputSource,
! const XalanDOMString& identifier) = 0;
/**
***************
*** 151,184 ****
const InputSourceType& inputSource,
DocumentHandlerType& handler,
! const XalanDOMString& identifier = XalanDOMString()) = 0;
!
! /**
! * Create an empty DOM Document. Mainly used for creating an
! * output document.
! *
! * The liaison owns the XalanDocument instance, and will delete it when
! * when asked (see DestroyDocument()), or when the liaison is reset, or
! * goes out of scope.
! *
! * @return DOM document created
! */
! virtual XalanDocument*
! createDocument() = 0;
!
! /**
! * Get a factory object required to create nodes in the result tree.
! *
! * The liaison owns the XalanDocument instance, and will delete it when
! * when asked (see destroyDocument()), or when the liaison is reset, or
! * goes out of scope.
! *
! * @return A XalanDocument instance.
! */
! virtual XalanDocument*
! createDOMFactory() = 0;
/**
* Destroy the supplied XalanDocument instance. It must be an instance that
! * was created by a previous call to createDocument() or getDOMFactory().
*
* @param theDocument The XalanDocument instance to destroy.
--- 114,122 ----
const InputSourceType& inputSource,
DocumentHandlerType& handler,
! const XalanDOMString& identifier) = 0;
/**
* Destroy the supplied XalanDocument instance. It must be an instance that
! * was created by a previous call to parseXMLStream().
*
* @param theDocument The XalanDocument instance to destroy.
***************
*** 230,235 ****
* @return string describing parser
*/
! virtual const XalanDOMString
! getParserDescription() const = 0;
/**
--- 168,173 ----
* @return string describing parser
*/
! virtual const XalanDOMString&
! getParserDescription(XalanDOMString& theResult) const = 0;
/**
Index: XMLSupportException.hpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Include/xalanc/XMLSupport/XMLSupportException.hpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XMLSupportException.hpp 8 Apr 2004 07:56:59 -0000 1.1.1.1
--- XMLSupportException.hpp 19 Feb 2008 20:14:03 -0000 1.2
***************
*** 1,57 ****
/*
! * The Apache Software License, Version 1.1
! *
! *
! * Copyright (c) 1999-2004 The Apache Software Foundation. All rights
! * reserved.
! *
! * Redistribution and use in source and binary forms, with or without
! * modification, are permitted provided that the following conditions
! * are met:
! *
! * 1. Redistributions of source code must retain the above copyright
! * notice, this list of conditions and the following disclaimer.
! *
! * 2. Redistributions in binary form must reproduce the above copyright
! * notice, this list of conditions and the following disclaimer in
! * the documentation and/or other materials provided with the
! * distribution.
! *
! * 3. The end-user documentation included with the redistribution,
! * if any, must include the following acknowledgment:
! * "This product includes software developed by the
! * Apache Software Foundation (http://www.apache.org/)."
! * Alternately, this acknowledgment may appear in the software itself,
! * if and wherever such third-party acknowledgments normally appear.
! *
! * 4. The names "Xalan" and "Apache Software Foundation" must
! * not be used to endorse or promote products derived from this
! * software without prior written permission. For written
! * permission, please contact apache at apache.org.
*
! * 5. Products derived from this software may not be called "Apache",
! * nor may "Apache" appear in their name, without prior written
! * permission of the Apache Software Foundation.
*
! * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
! * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
! * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
! * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
! * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
! * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
! * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! * SUCH DAMAGE.
! * ====================================================================
*
! * This software consists of voluntary contributions made by many
! * individuals on behalf of the Apache Software Foundation and was
! * originally based on software copyright (c) 1999, International
! * Business Machines, Inc., http://www.ibm.com. For more
! * information on the Apache Software Foundation, please see
! * <http://www.apache.org/>.
*/
#if !defined(XMLSUPPORTEXCEPTION_HEADER_GUARD_1357924680)
--- 1,16 ----
/*
! * Copyright 1999-2004 The Apache Software Foundation.
*
! * Licensed under the Apache License, Version 2.0 (the "License");
! * you may not use this file except in compliance with the License.
! * You may obtain a copy of the License at
*
! * http://www.apache.org/licenses/LICENSE-2.0
*
! * Unless required by applicable law or agreed to in writing, software
! * distributed under the License is distributed on an "AS IS" BASIS,
! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! * See the License for the specific language governing permissions and
! * limitations under the License.
*/
#if !defined(XMLSUPPORTEXCEPTION_HEADER_GUARD_1357924680)
***************
*** 88,92 ****
*/
explicit
! XMLSupportException(const XalanDOMString& message);
virtual
--- 47,53 ----
*/
explicit
! XMLSupportException(const XalanDOMString& message,
! MemoryManagerType& theManager);
!
virtual
--- NEW FILE: XalanUTF16Writer.hpp ---
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANUTF16WRITER_HEADER_GUARD_1357924680)
#define XALANUTF16WRITER_HEADER_GUARD_1357924680
#include <xalanc/XMLSupport/XalanFormatterWriter.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class XalanUTF16Writer : public XalanFormatterWriter
{
public:
typedef XalanDOMChar value_type;
XalanUTF16Writer(
Writer& writer,
MemoryManager& theMemoryManager);
virtual
~XalanUTF16Writer()
{
}
/**
* Output a line break.
*/
void
outputNewline()
{
assert(m_newlineString != 0);
assert(length(m_newlineString) == m_newlineStringLength);
write(
m_newlineString,
m_newlineStringLength);
}
size_type
writeCDATAChar(
const XalanDOMChar chars[],
size_type start,
size_type /*length*/,
bool& /* outsideCDATA */)
{
assert( chars != 0 );
write(chars[start]);
return start;
}
/**
* Writes name chars , if not presentable, throws
*/
void writeNameChar(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
}
/**
* Writes name chars , if not presentable, throws
*/
void writePIChars(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
}
/**
* Writes name chars , if not presentable, throws
*/
void writeCommentChars(const XalanDOMChar* data,
size_type theLength)
{
write(data, theLength);
}
void
safeWriteContent(
const XalanDOMChar* theChars,
size_type theLength)
{
write(theChars, theLength);
}
void
write(
const value_type* theChars,
size_type theLength)
{
if (theLength > sizeof(m_buffer))
{
flushBuffer();
m_writer.write(theChars, 0, theLength);
}
else
{
if (m_bufferRemaining < theLength)
{
flushBuffer();
}
for(size_type i = 0; i < theLength; ++i)
{
*m_bufferPosition = theChars[i];
++m_bufferPosition;
}
m_bufferRemaining -= theLength;
}
}
void
write(const XalanDOMString& theChars)
{
write(theChars.c_str(), theChars.length());
}
void
write(value_type theChar)
{
if (m_bufferRemaining == 0)
{
flushBuffer();
}
*m_bufferPosition = theChar;
++m_bufferPosition;
--m_bufferRemaining;
}
size_type
write(
const value_type chars[],
size_type start,
size_type /*length*/)
{
write(chars[start]);
return start;
}
void
writeSafe(
const XalanDOMChar* theChars,
size_type theLength)
{
write(theChars, theLength);
}
void
write(const value_type* theChars)
{
write(theChars, XalanDOMString::length(theChars));
}
void
flushBuffer()
{
m_writer.write(
reinterpret_cast<const char*>(m_buffer),
0,
(m_bufferPosition - m_buffer) * sizeof m_buffer[0]);
m_bufferPosition = m_buffer;
m_bufferRemaining = kBufferSize;
}
private:
enum
{
kBufferSize = 512 // The size of the buffer
};
// Data members...
value_type m_buffer[kBufferSize];
value_type* m_bufferPosition;
size_type m_bufferRemaining;
};
XALAN_CPP_NAMESPACE_END
#endif // XALANUTF16WRITER_HEADER_GUARD_1357924680
- Previous message: [GME-commit] GMESRC/GME/Include/xalanc/XercesParserLiaison XercesWrapperNavigatorAllocator.hpp, NONE, 1.1 FormatterToXercesDOM.hpp, 1.1.1.1, 1.2 XercesAttrWrapper.hpp, 1.1.1.1, 1.2 XercesAttrWrapperAllocator.hpp, 1.1.1.1, 1.2 XercesCDATASectionWrapper.hpp, 1.1.1.1, 1.2 XercesCommentWrapper.hpp, 1.1.1.1, 1.2 XercesDOMException.hpp, 1.1.1.1, 1.2 XercesDOMFormatterWalker.hpp, 1.1.1.1, 1.2 XercesDOMImplementationWrapper.hpp, 1.1.1.1, 1.2 XercesDOMSupport.hpp, 1.1.1.1, 1.2 XercesDOMWalker.hpp, 1.1.1.1, 1.2 XercesDOMWrapperException.hpp, 1.1.1.1, 1.2 XercesDocumentTypeWrapper.hpp, 1.1.1.1, 1.2 XercesDocumentWrapper.hpp, 1.1.1.1, 1.2 XercesElementWrapper.hpp, 1.1.1.1, 1.2 XercesElementWrapperAllocator.hpp, 1.1.1.1, 1.2 XercesEntityReferenceWrapper.hpp, 1.1.1.1, 1.2 XercesEntityWrapper.hpp, 1.1.1.1, 1.2 XercesLiaisonXalanDOMStringPool.hpp, 1.1.1.1, 1.2 XercesNamedNodeMapAttributeList.hpp, 1.1.1.1, 1.2 XercesNamedNodeMapWrapper.hpp, 1.1.1.1, 1.2 XercesNodeListWrapper.hpp, 1.1.1.1, 1.2 XercesNotationWrapper.hpp, 1.1.1.1, 1.2 XercesPar serLiaison.hpp, 1.1.1.1, 1.2 XercesParserLiaisonDefinitions.hpp, 1.1.1.1, 1.2 XercesProcessingInstructionWrapper.hpp, 1.1.1.1, 1.2 XercesTextWrapper.hpp, 1.1.1.1, 1.2 XercesTextWrapperAllocator.hpp, 1.1.1.1, 1.2 XercesWrapperHelper.hpp, 1.1.1.1, 1.2 XercesWrapperNavigator.hpp, 1.1.1.1, 1.2 XercesWrapperToXalanNodeMap.hpp, 1.1.1.1, 1.2 XercesWrapperTypes.hpp, 1.1.1.1, 1.2
- Next message: [GME-commit] GMESRC/GME/Include/xalanc/XalanDOM XalanAttr.hpp, 1.1.1.1, 1.2 XalanCDATASection.hpp, 1.1.1.1, 1.2 XalanCharacterData.hpp, 1.1.1.1, 1.2 XalanComment.hpp, 1.1.1.1, 1.2 XalanDOMDefinitions.hpp, 1.1.1.1, 1.2 XalanDOMException.hpp, 1.1.1.1, 1.2 XalanDOMImplementation.hpp, 1.1.1.1, 1.2 XalanDOMInit.hpp, 1.1.1.1, 1.2 XalanDOMString.hpp, 1.1.1.1, 1.2 XalanDocument.hpp, 1.1.1.1, 1.2 XalanDocumentFragment.hpp, 1.1.1.1, 1.2 XalanDocumentType.hpp, 1.1.1.1, 1.2 XalanElement.hpp, 1.1.1.1, 1.2 XalanEmptyNamedNodeMap.hpp, 1.1.1.1, 1.2 XalanEntity.hpp, 1.1.1.1, 1.2 XalanEntityReference.hpp, 1.1.1.1, 1.2 XalanNamedNodeMap.hpp, 1.1.1.1, 1.2 XalanNode.hpp, 1.1.1.1, 1.2 XalanNodeList.hpp, 1.1.1.1, 1.2 XalanNodeListDummy.hpp, 1.1.1.1, 1.2 XalanNodeListSurrogate.hpp, 1.1.1.1, 1.2 XalanNotation.hpp, 1.1.1.1, 1.2 XalanProcessingInstruction.hpp, 1.1.1.1, 1.2 XalanText.hpp, 1.1.1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the GME-commit
mailing list