00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680) 00017 #define FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680 00018 00019 00020 00021 00022 // Base include file. Must be first. 00023 #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp> 00024 00025 00026 00027 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00028 00029 00030 00031 // Base class header file. 00032 #include "FormatterToXMLBase.hpp" 00033 00034 00035 00036 XALAN_CPP_NAMESPACE_BEGIN 00037 00038 00039 00043 class XALAN_XMLSUPPORT_EXPORT FormatterToXML_UTF16 : public FormatterToXMLBase 00044 { 00045 public: 00046 00050 static void 00051 initialize(); 00052 00056 static void 00057 terminate(); 00058 00074 FormatterToXML_UTF16( 00075 Writer& writer, 00076 const XalanDOMString& version = XalanDOMString(), 00077 const XalanDOMString& mediaType = XalanDOMString(), 00078 const XalanDOMString& doctypeSystem = XalanDOMString(), 00079 const XalanDOMString& doctypePublic = XalanDOMString(), 00080 bool xmlDecl = true, 00081 const XalanDOMString& standalone = XalanDOMString()); 00082 00083 virtual 00084 ~FormatterToXML_UTF16(); 00085 00086 00087 // These methods are inherited from FormatterListener ... 00088 00089 virtual void 00090 startElement( 00091 const XMLCh* const name, 00092 AttributeListType& attrs); 00093 00094 virtual void 00095 endElement(const XMLCh* const name); 00096 00097 virtual void 00098 charactersRaw( 00099 const XMLCh* const chars, 00100 const unsigned int length); 00101 00102 virtual void 00103 entityReference(const XMLCh* const name); 00104 00105 virtual void 00106 comment(const XMLCh* const data); 00107 00108 virtual const XalanDOMString& 00109 getEncoding() const; 00110 00111 protected: 00112 00113 virtual void 00114 writeXMLHeader(); 00115 00116 virtual void 00117 flushBuffer(); 00118 00119 virtual void 00120 writeDoctypeDecl(const XalanDOMChar* name); 00121 00122 virtual void 00123 writeProcessingInstruction( 00124 const XMLCh* target, 00125 const XMLCh* data); 00126 00127 virtual void 00128 writeCharacters( 00129 const XMLCh* chars, 00130 unsigned int length); 00131 00132 virtual void 00133 writeCDATA( 00134 const XMLCh* chars, 00135 unsigned int length); 00136 00137 virtual void 00138 outputNewline(); 00139 00143 void 00144 writeDefaultEscape(XalanDOMChar ch); 00145 00149 void 00150 writeDefaultAttributeEscape(XalanDOMChar ch); 00151 00156 bool 00157 writeDefaultEntity(XalanDOMChar ch); 00158 00163 bool 00164 writeDefaultAttributeEntity(XalanDOMChar ch); 00165 00170 void 00171 writeCommentData(const XalanDOMChar* data); 00172 00177 void 00178 writeParentTagEnd(); 00179 00184 void 00185 writeNormalizedChar(XalanDOMChar ch); 00186 00193 void 00194 writeCDATAChars( 00195 const XalanDOMChar ch[], 00196 XalanDOMString::size_type length); 00197 00204 void 00205 writeAttrString( 00206 const XalanDOMChar* theString, 00207 XalanDOMString::size_type theStringLength); 00208 00209 private: 00210 00211 // These are not implemented. 00212 FormatterToXML_UTF16(const FormatterToXML_UTF16&); 00213 00214 FormatterToXML_UTF16& 00215 operator=(const FormatterToXML_UTF16&); 00216 00217 bool 00218 operator==(const FormatterToXML_UTF16&) const; 00219 00220 void 00221 write( 00222 const XalanDOMChar* theChars, 00223 XalanDOMString::size_type theLength); 00224 00225 void 00226 writeName(const XalanDOMChar* theChars); 00227 00228 void 00229 write(const XalanDOMChar* theChars) 00230 { 00231 write(theChars, XalanDOMString::length(theChars)); 00232 } 00233 00234 void 00235 write(XalanDOMChar theChar) 00236 { 00237 write(&theChar, 1); 00238 } 00239 00240 void 00241 write(const XalanDOMString& theChars) 00242 { 00243 write(theChars.c_str(), theChars.length()); 00244 } 00245 00251 void 00252 outputDocTypeDecl(const XalanDOMChar* name); 00253 00259 void 00260 processAttribute( 00261 const XalanDOMChar* name, 00262 const XalanDOMChar* value); 00263 00269 void 00270 writeNormalizedPIData( 00271 const XalanDOMChar* theData, 00272 XalanDOMString::size_type theLength); 00273 00274 // Data members... 00275 00279 static const XalanDOMString& s_utf16String; 00280 00284 static const XalanDOMChar s_doctypeHeaderStartString[]; 00285 00286 static const XalanDOMString::size_type s_doctypeHeaderStartStringLength; 00287 00291 static const XalanDOMChar s_doctypeHeaderPublicString[]; 00292 00293 static const XalanDOMString::size_type s_doctypeHeaderPublicStringLength; 00294 00298 static const XalanDOMChar s_doctypeHeaderSystemString[]; 00299 00300 static const XalanDOMString::size_type s_doctypeHeaderSystemStringLength; 00301 00305 static const XalanDOMChar s_xmlHeaderStartString[]; 00306 00307 static const XalanDOMString::size_type s_xmlHeaderStartStringLength; 00308 00312 static const XalanDOMChar s_xmlHeaderEncodingString[]; 00313 00314 static const XalanDOMString::size_type s_xmlHeaderEncodingStringLength; 00315 00319 static const XalanDOMChar s_xmlHeaderStandaloneString[]; 00320 00321 static const XalanDOMString::size_type s_xmlHeaderStandaloneStringLength; 00322 00326 static const XalanDOMChar s_xmlHeaderEndString[]; 00327 00328 static const XalanDOMString::size_type s_xmlHeaderEndStringLength; 00329 00333 static const XalanDOMChar s_defaultVersionString[]; 00334 00335 static const XalanDOMString::size_type s_defaultVersionStringLength; 00336 00340 static const XalanDOMChar s_xhtmlDocTypeString[]; 00341 00342 static const XalanDOMString::size_type s_xhtmlDocTypeStringLength; 00343 00347 static const XalanDOMChar s_cdataOpenString[]; 00348 00349 static const XalanDOMString::size_type s_cdataOpenStringLength; 00350 00354 static const XalanDOMChar s_cdataCloseString[]; 00355 00356 static const XalanDOMString::size_type s_cdataCloseStringLength; 00357 00361 static const XalanDOMChar s_lessThanEntityString[]; 00362 00363 static const XalanDOMString::size_type s_lessThanEntityStringLength; 00364 00368 static const XalanDOMChar s_greaterThanEntityString[]; 00369 00370 static const XalanDOMString::size_type s_greaterThanEntityStringLength; 00371 00375 static const XalanDOMChar s_ampersandEntityString[]; 00376 00377 static const XalanDOMString::size_type s_ampersandEntityStringLength; 00378 00382 static const XalanDOMChar s_quoteEntityString[]; 00383 00384 static const XalanDOMString::size_type s_quoteEntityStringLength; 00385 00389 static const XalanDOMChar s_linefeedNCRString[]; 00390 00391 static const XalanDOMString::size_type s_linefeedNCRStringLength; 00392 00396 static const XalanDOMChar s_carriageReturnNCRString[]; 00397 00398 static const XalanDOMString::size_type s_carriageReturnNCRStringLength; 00399 00403 static const XalanDOMChar s_htabNCRString[]; 00404 00405 static const XalanDOMString::size_type s_htabNCRStringLength; 00406 00407 enum 00408 { 00409 kBufferSize = 512 // The size of the buffer 00410 }; 00411 00412 static bool 00413 isContentSpecial(XalanDOMChar theChar) 00414 { 00415 if ((theChar < kSpecialsSize) && (s_specialChars[theChar] & kContentSpecial)) 00416 { 00417 return true; 00418 } 00419 else 00420 { 00421 return false; 00422 } 00423 } 00424 00425 static bool 00426 isAttributeSpecial(XalanDOMChar theChar) 00427 { 00428 if ((theChar < kSpecialsSize) && (s_specialChars[theChar] & kAttributeSpecial)) 00429 { 00430 return true; 00431 } 00432 else 00433 { 00434 return false; 00435 } 00436 } 00437 00438 00439 XalanDOMChar m_buffer[kBufferSize]; 00440 00441 XalanDOMChar* m_bufferPosition; 00442 00443 XalanDOMString::size_type m_bufferRemaining; 00444 }; 00445 00446 00447 00448 XALAN_CPP_NAMESPACE_END 00449 00450 00451 00452 #endif // FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.8 |
|