Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.7

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

FormatterToXML_UTF16.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights 
00006  * reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer. 
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. The end-user documentation included with the redistribution,
00021  *    if any, must include the following acknowledgment:  
00022  *       "This product includes software developed by the
00023  *        Apache Software Foundation (http://www.apache.org/)."
00024  *    Alternately, this acknowledgment may appear in the software itself,
00025  *    if and wherever such third-party acknowledgments normally appear.
00026  *
00027  * 4. The names "Xalan" and "Apache Software Foundation" must
00028  *    not be used to endorse or promote products derived from this
00029  *    software without prior written permission. For written 
00030  *    permission, please contact apache@apache.org.
00031  *
00032  * 5. Products derived from this software may not be called "Apache",
00033  *    nor may "Apache" appear in their name, without prior written
00034  *    permission of the Apache Software Foundation.
00035  *
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00047  * SUCH DAMAGE.
00048  * ====================================================================
00049  *
00050  * This software consists of voluntary contributions made by many
00051  * individuals on behalf of the Apache Software Foundation and was
00052  * originally based on software copyright (c) 1999, International
00053  * Business Machines, Inc., http://www.ibm.com.  For more
00054  * information on the Apache Software Foundation, please see
00055  * <http://www.apache.org/>.
00056  */
00057 #if !defined(FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680)
00058 #define FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680
00059 
00060 
00061 
00062 
00063 // Base include file.  Must be first.
00064 #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
00065 
00066 
00067 
00068 #include <xalanc/XalanDOM/XalanDOMString.hpp>
00069 
00070 
00071 
00072 // Base class header file.
00073 #include "FormatterToXMLBase.hpp"
00074 
00075 
00076 
00077 XALAN_CPP_NAMESPACE_BEGIN
00078 
00079 
00080 
00084 class XALAN_XMLSUPPORT_EXPORT FormatterToXML_UTF16 : public FormatterToXMLBase 
00085 {
00086 public:
00087 
00091     static void
00092     initialize();
00093  
00097     static void
00098     terminate();
00099 
00115     FormatterToXML_UTF16(
00116             Writer&                 writer,
00117             const XalanDOMString&   version = XalanDOMString(),
00118             const XalanDOMString&   mediaType = XalanDOMString(),
00119             const XalanDOMString&   doctypeSystem = XalanDOMString(),
00120             const XalanDOMString&   doctypePublic = XalanDOMString(),
00121             bool                    xmlDecl = true,
00122             const XalanDOMString&   standalone = XalanDOMString());
00123 
00124     virtual
00125     ~FormatterToXML_UTF16();
00126 
00127 
00128     // These methods are inherited from FormatterListener ...
00129 
00130     virtual void
00131     startElement(
00132             const XMLCh* const  name,
00133             AttributeListType&  attrs);
00134 
00135     virtual void
00136     endElement(const XMLCh* const   name);
00137 
00138     virtual void
00139     charactersRaw(
00140             const XMLCh* const  chars,
00141             const unsigned int  length);
00142 
00143     virtual void
00144     entityReference(const XMLCh* const  name);
00145 
00146     virtual void
00147     comment(const XMLCh* const  data);
00148 
00149     virtual const XalanDOMString&
00150     getEncoding() const;
00151 
00152 protected:
00153 
00154     virtual void
00155     writeXMLHeader();
00156 
00157     virtual void
00158     flushBuffer();
00159 
00160     virtual void
00161     writeDoctypeDecl(const XalanDOMChar*    name);
00162 
00163     virtual void
00164     writeProcessingInstruction(
00165             const XMLCh*    target,
00166             const XMLCh*    data);
00167 
00168     virtual void
00169     writeCharacters(
00170             const XMLCh*    chars,
00171             unsigned int    length);
00172 
00173     virtual void
00174     writeCDATA(
00175             const XMLCh*    chars,
00176             unsigned int    length);
00177 
00181     void
00182     outputLineSep();
00183 
00187     void
00188     writeDefaultEscape(XalanDOMChar     ch);
00189 
00193     void
00194     writeDefaultAttributeEscape(XalanDOMChar    ch);
00195 
00200     bool
00201     writeDefaultEntity(XalanDOMChar     ch);
00202 
00207     bool
00208     writeDefaultAttributeEntity(XalanDOMChar    ch);
00209 
00214     void
00215     writeCommentData(const XalanDOMChar*    data);
00216 
00221     void
00222     writeParentTagEnd();
00223 
00228     void
00229     writeNormalizedChar(XalanDOMChar    ch);
00230 
00237     void
00238     writeCDATAChars(
00239             const XalanDOMChar          ch[],
00240             XalanDOMString::size_type   length);
00241 
00248     void
00249     writeAttrString(
00250             const XalanDOMChar*         theString,
00251             XalanDOMString::size_type   theStringLength);
00252 
00253 private:
00254 
00255     // These are not implemented.
00256     FormatterToXML_UTF16(const FormatterToXML_UTF16&);
00257 
00258     FormatterToXML_UTF16&
00259     operator=(const FormatterToXML_UTF16&);
00260 
00261     bool
00262     operator==(const FormatterToXML_UTF16&) const;
00263 
00264     void
00265     write(
00266             const XalanDOMChar*         theChars,
00267             XalanDOMString::size_type   theLength);
00268 
00269     void
00270     writeName(const XalanDOMChar*   theChars);
00271 
00272     void
00273     write(const XalanDOMChar*   theChars)
00274     {
00275         write(theChars, XalanDOMString::length(theChars));
00276     }
00277 
00278     void
00279     write(XalanDOMChar  theChar)
00280     {
00281         write(&theChar, 1);
00282     }
00283 
00284     void
00285     write(const XalanDOMString&     theChars)
00286     {
00287         write(theChars.c_str(), theChars.length());
00288     }
00289 
00295     void
00296     outputDocTypeDecl(const XalanDOMChar*   name);
00297 
00303     void
00304     processAttribute(
00305             const XalanDOMChar*     name,
00306             const XalanDOMChar*     value);
00307 
00313     void
00314     writeNormalizedPIData(
00315             const XalanDOMChar*         theData,
00316             XalanDOMString::size_type   theLength);
00317 
00318     // Data members...
00319 
00323     static const XalanDOMString&    s_utf16String;
00324 
00328     static const XalanDOMChar               s_doctypeHeaderStartString[];
00329 
00330     static const XalanDOMString::size_type  s_doctypeHeaderStartStringLength;
00331 
00335     static const XalanDOMChar               s_doctypeHeaderPublicString[];
00336 
00337     static const XalanDOMString::size_type  s_doctypeHeaderPublicStringLength;
00338 
00342     static const XalanDOMChar               s_doctypeHeaderSystemString[];
00343 
00344     static const XalanDOMString::size_type  s_doctypeHeaderSystemStringLength;
00345 
00349     static const XalanDOMChar               s_xmlHeaderStartString[];
00350 
00351     static const XalanDOMString::size_type  s_xmlHeaderStartStringLength;
00352 
00356     static const XalanDOMChar               s_xmlHeaderEncodingString[];
00357 
00358     static const XalanDOMString::size_type  s_xmlHeaderEncodingStringLength;
00359 
00363     static const XalanDOMChar               s_xmlHeaderStandaloneString[];
00364 
00365     static const XalanDOMString::size_type  s_xmlHeaderStandaloneStringLength;
00366 
00370     static const XalanDOMChar               s_xmlHeaderEndString[];
00371 
00372     static const XalanDOMString::size_type  s_xmlHeaderEndStringLength;
00373 
00377     static const XalanDOMChar               s_defaultVersionString[];
00378 
00379     static const XalanDOMString::size_type  s_defaultVersionStringLength;
00380 
00384     static const XalanDOMChar               s_xhtmlDocTypeString[];
00385 
00386     static const XalanDOMString::size_type  s_xhtmlDocTypeStringLength;
00387 
00391     static const XalanDOMChar               s_cdataOpenString[];
00392 
00393     static const XalanDOMString::size_type  s_cdataOpenStringLength;
00394 
00398     static const XalanDOMChar               s_cdataCloseString[];
00399 
00400     static const XalanDOMString::size_type  s_cdataCloseStringLength;
00401 
00405     static const XalanDOMChar               s_lessThanEntityString[];
00406 
00407     static const XalanDOMString::size_type  s_lessThanEntityStringLength;
00408 
00412     static const XalanDOMChar               s_greaterThanEntityString[];
00413 
00414     static const XalanDOMString::size_type  s_greaterThanEntityStringLength;
00415 
00419     static const XalanDOMChar               s_ampersandEntityString[];
00420 
00421     static const XalanDOMString::size_type  s_ampersandEntityStringLength;
00422 
00426     static const XalanDOMChar               s_quoteEntityString[];
00427 
00428     static const XalanDOMString::size_type  s_quoteEntityStringLength;
00429 
00433     static const XalanDOMChar               s_linefeedNCRString[];
00434 
00435     static const XalanDOMString::size_type  s_linefeedNCRStringLength;
00436 
00440     static const XalanDOMChar               s_htabNCRString[];
00441 
00442     static const XalanDOMString::size_type  s_htabNCRStringLength;
00443 
00444     enum
00445     {
00446         kBufferSize = 512       // The size of the buffer
00447     };
00448 
00449     static bool
00450     isContentSpecial(XalanDOMChar   theChar)
00451     {
00452         if ((theChar < kSpecialsSize) && (s_specialChars[theChar] & kContentSpecial))
00453         {
00454             return true;
00455         }
00456         else
00457         {
00458             return false;
00459         }
00460     }
00461 
00462     static bool
00463     isAttributeSpecial(XalanDOMChar     theChar)
00464     {
00465         if ((theChar < kSpecialsSize) && (s_specialChars[theChar] & kAttributeSpecial))
00466         {
00467             return true;
00468         }
00469         else
00470         {
00471             return false;
00472         }
00473     }
00474 
00475 
00476     XalanDOMChar                m_buffer[kBufferSize];
00477 
00478     XalanDOMChar*               m_bufferPosition;
00479 
00480     XalanDOMString::size_type   m_bufferRemaining;
00481 };
00482 
00483 
00484 
00485 XALAN_CPP_NAMESPACE_END
00486 
00487 
00488 
00489 #endif  // FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.7
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.