00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(FORMATTERTOXML_UNICODE_HEADER_GUARD_1357924680) 00019 #define FORMATTERTOXML_UNICODE_HEADER_GUARD_1357924680 00020 00021 00022 // Base include file. Must be first. 00023 #include "xalanc/XMLSupport/XMLSupportDefinitions.hpp" 00024 00025 00026 00027 #include "xalanc/XMLSupport/XalanXMLSerializerBase.hpp" 00028 00029 00030 00031 #include "xercesc/sax/AttributeList.hpp" 00032 00033 00034 00035 #include "xalanc/PlatformSupport/DoubleSupport.hpp" 00036 #include "xalanc/PlatformSupport/XalanOutputStream.hpp" 00037 #include "xalanc/PlatformSupport/XalanUnicode.hpp" 00038 00039 00040 00041 #include <xalanc/DOMSupport/DOMServices.hpp> 00042 00043 00044 00045 XALAN_CPP_NAMESPACE_BEGIN 00046 00047 00048 /** 00049 * FormatterToXMLUnicode formats SAX-style events into XML. 00050 */ 00051 template< 00052 class UnicodeWriter, 00053 class ConstantsType, 00054 class CharPredicate, 00055 class IndentHandler, 00056 FormatterListener::eXMLVersion XMLVersion> 00057 class XALAN_XMLSUPPORT_EXPORT FormatterToXMLUnicode : public XalanXMLSerializerBase 00058 { 00059 public: 00060 00061 typedef typename UnicodeWriter::value_type value_type; 00062 00063 enum 00064 { 00065 eDefaultIndentAmount = 0 00066 }; 00067 00068 /** 00069 * Constructor 00070 * 00071 * @param theManager The MemoryManager instance to use for all memory allocations 00072 * @param writer the writer. 00073 * @param version the string to write for the XML version number. 00074 * @param doctypeSystem system identifier to be used in the document 00075 * type declaration 00076 * @param doctypePublic public identifier to be used in the document 00077 * type declaration 00078 * @param xmlDecl true if the XSLT processor should output an XML 00079 * declaration 00080 * @param standalone The string the XSLT processor should output for 00081 * the standalone document declaration 00082 * 00083 */ 00084 FormatterToXMLUnicode( 00085 MemoryManager& theManager, 00086 Writer& writer, 00087 const XalanDOMString& encoding, 00088 const XalanDOMString& doctypeSystem = s_emptyString, 00089 const XalanDOMString& doctypePublic = s_emptyString, 00090 bool xmlDecl = true, 00091 const XalanDOMString& standalone = s_emptyString, 00092 size_type indent = eDefaultIndentAmount) : 00093 XalanXMLSerializerBase( 00094 theManager, 00095 XMLVersion, 00096 encoding, 00097 doctypeSystem, 00098 doctypePublic, 00099 xmlDecl, 00100 standalone), 00101 m_stringBuffer(theManager), 00102 m_writer(writer, theManager), 00103 m_constants(), 00104 m_charPredicate(), 00105 m_indentHandler(m_writer , indent) 00106 { 00107 } 00108 00109 static FormatterToXMLUnicode* 00110 create( 00111 MemoryManager& theManager, 00112 Writer& writer, 00113 const XalanDOMString& encoding, 00114 const XalanDOMString& doctypeSystem = s_emptyString, 00115 const XalanDOMString& doctypePublic = s_emptyString, 00116 bool xmlDecl = true, 00117 const XalanDOMString& standalone = s_emptyString, 00118 size_type indent = eDefaultIndentAmount) 00119 { 00120 00121 typedef FormatterToXMLUnicode ThisType; 00122 00123 XalanAllocationGuard theGuard(theManager, theManager.allocate(sizeof(ThisType))); 00124 00125 ThisType* const theResult = 00126 new (theGuard.get()) ThisType( 00127 theManager, 00128 writer, 00129 encoding, 00130 doctypeSystem, 00131 doctypePublic, 00132 xmlDecl, 00133 standalone, 00134 indent); 00135 00136 theGuard.release(); 00137 00138 return theResult; 00139 } 00140 00141 virtual 00142 ~FormatterToXMLUnicode() 00143 { 00144 } 00145 00146 Writer* 00147 getWriter() const 00148 { 00149 return m_writer.getWriter(); 00150 } 00151 00152 // These are inherited from XalanXMLSerializerBase... 00153 00154 virtual void 00155 endDocument() 00156 { 00157 m_indentHandler.setStartNewLine(true); 00158 00159 m_indentHandler.indent(); 00160 00161 flushBuffer(); 00162 00163 flushWriter(); 00164 } 00165 00166 virtual void 00167 startElement( 00168 const XMLCh* const name, 00169 AttributeList& attrs) 00170 { 00171 generateDoctypeDecl(name); 00172 00173 writeParentTagEnd(); 00174 00175 m_indentHandler.setPreserve(false); 00176 00177 m_indentHandler.indent(); 00178 00179 m_indentHandler.setStartNewLine(true); 00180 00181 m_writer.write(value_type(XalanUnicode::charLessThanSign)); 00182 00183 writeName(name); 00184 00185 const XalanSize_t nAttrs = attrs.getLength(); 00186 00187 for (XalanSize_t i = 0; i < nAttrs ; i++) 00188 { 00189 processAttribute(attrs.getName(i), attrs.getValue(i)); 00190 } 00191 00192 // Flag the current element as not yet having any children. 00193 openElementForChildren(); 00194 00195 m_indentHandler.increaseIndent(); 00196 00197 m_indentHandler.setPrevText(false); 00198 } 00199 00200 virtual void 00201 endElement(const XMLCh* const name) 00202 { 00203 m_indentHandler.decreaseIndent(); 00204 00205 const bool hasChildNodes = childNodesWereAdded(); 00206 00207 if (hasChildNodes == true) 00208 { 00209 m_indentHandler.indent(); 00210 00211 m_writer.write(value_type(XalanUnicode::charLessThanSign)); 00212 m_writer.write(value_type(XalanUnicode::charSolidus)); 00213 00214 writeName(name); 00215 } 00216 else 00217 { 00218 if(m_spaceBeforeClose == true) 00219 { 00220 m_writer.write(value_type(XalanUnicode::charSpace)); 00221 } 00222 00223 m_writer.write(value_type(XalanUnicode::charSolidus)); 00224 } 00225 00226 m_writer.write(value_type(XalanUnicode::charGreaterThanSign)); 00227 00228 if (hasChildNodes == true) 00229 { 00230 m_indentHandler.pop_preserve(); 00231 } 00232 00233 m_indentHandler.setPrevText(false); 00234 } 00235 00236 virtual void 00237 charactersRaw( 00238 const XMLCh* const chars, 00239 const size_type length) 00240 { 00241 writeParentTagEnd(); 00242 00243 m_indentHandler.setPreserve(true); 00244 00245 m_writer.write(chars, length); 00246 } 00247 00248 00249 virtual void 00250 entityReference(const XMLCh* const name) 00251 { 00252 writeParentTagEnd(); 00253 00254 m_indentHandler.indent(); 00255 00256 m_writer.write(value_type(XalanUnicode::charAmpersand)); 00257 00258 writeName(name); 00259 00260 m_writer.write(value_type(XalanUnicode::charSemicolon)); 00261 } 00262 00263 virtual void 00264 comment(const XMLCh* const data) 00265 { 00266 writeParentTagEnd(); 00267 00268 m_indentHandler.indent(); 00269 00270 m_writer.write(value_type(XalanUnicode::charLessThanSign)); 00271 m_writer.write(value_type(XalanUnicode::charExclamationMark)); 00272 m_writer.write(value_type(XalanUnicode::charHyphenMinus)); 00273 m_writer.write(value_type(XalanUnicode::charHyphenMinus)); 00274 00275 writeNormalizedData(data, XalanDOMString::length(data)); 00276 00277 m_writer.write(value_type(XalanUnicode::charHyphenMinus)); 00278 m_writer.write(value_type(XalanUnicode::charHyphenMinus)); 00279 m_writer.write(value_type(XalanUnicode::charGreaterThanSign)); 00280 00281 m_indentHandler.setStartNewLine(true); 00282 } 00283 00284 protected: 00285 00286 virtual void 00287 flushBuffer() 00288 { 00289 m_writer.flushBuffer(); 00290 } 00291 00292 virtual void 00293 flushWriter() 00294 { 00295 m_writer.flushWriter(); 00296 } 00297 00298 virtual void 00299 writeXMLHeader() 00300 { 00301 // "<?xml version=\"" 00302 m_writer.write( 00303 m_constants.s_xmlHeaderStartString, 00304 m_constants.s_xmlHeaderStartStringLength); 00305 00306 if (m_version.empty() == false) 00307 { 00308 m_writer.write(m_version); 00309 } 00310 else 00311 { 00312 m_writer.write( 00313 m_constants.s_defaultVersionString, 00314 m_constants.s_defaultVersionStringLength); 00315 } 00316 00317 // "\" encoding=\"" 00318 m_writer.write( 00319 m_constants.s_xmlHeaderEncodingString, 00320 m_constants.s_xmlHeaderEncodingStringLength); 00321 00322 m_writer.write(m_encoding); 00323 00324 if (m_standalone.empty() == false) 00325 { 00326 m_writer.write( 00327 m_constants.s_xmlHeaderStandaloneString, 00328 m_constants.s_xmlHeaderStandaloneStringLength); 00329 00330 m_writer.write(m_standalone); 00331 } 00332 00333 m_writer.write( 00334 m_constants.s_xmlHeaderEndString, 00335 m_constants.s_xmlHeaderEndStringLength); 00336 00337 if (getNeedToOutputDoctypeDecl() == false) 00338 { 00339 m_indentHandler.outputLineSep(); 00340 } 00341 } 00342 00343 00344 void 00345 writeDoctypeDecl(const XalanDOMChar* name) 00346 { 00347 // "<!DOCTYPE " 00348 m_writer.write( 00349 m_constants.s_doctypeHeaderStartString, 00350 m_constants.s_doctypeHeaderStartStringLength); 00351 00352 m_writer.write(name); 00353 00354 if (m_doctypePublic.empty() == false) 00355 { 00356 // " PUBLIC \"" 00357 m_writer.write( 00358 m_constants.s_doctypeHeaderPublicString, 00359 m_constants.s_doctypeHeaderPublicStringLength); 00360 00361 writeName(m_doctypePublic.c_str()); 00362 00363 m_writer.write(value_type(XalanUnicode::charQuoteMark)); 00364 m_writer.write(value_type(XalanUnicode::charSpace)); 00365 m_writer.write(value_type(XalanUnicode::charQuoteMark)); 00366 } 00367 else 00368 { 00369 // " SYSTEM \"" 00370 m_writer.write( 00371 m_constants.s_doctypeHeaderSystemString, 00372 m_constants.s_doctypeHeaderSystemStringLength); 00373 } 00374 00375 writeName(m_doctypeSystem.c_str()); 00376 00377 m_writer.write(value_type(XalanUnicode::charQuoteMark)); 00378 m_writer.write(value_type(XalanUnicode::charGreaterThanSign)); 00379 00380 outputNewline(); 00381 } 00382 00383 00384 void 00385 writeProcessingInstruction( 00386 const XMLCh* target, 00387 const XMLCh* data) 00388 { 00389 writeParentTagEnd(); 00390 00391 m_indentHandler.indent(); 00392 00393 m_writer.write(value_type(XalanUnicode::charLessThanSign)); 00394 m_writer.write(value_type(XalanUnicode::charQuestionMark)); 00395 writeName(target); 00396 00397 const size_type len = length(data); 00398 00399 // We need to make sure there is a least one whitespace character 00400 // between the target and the data. 00401 if (len > 0 && !isXMLWhitespace(data[0])) 00402 { 00403 m_writer.write(value_type(XalanUnicode::charSpace)); 00404 } 00405 00406 writeNormalizedData(data, len); 00407 00408 m_writer.write(value_type(XalanUnicode::charQuestionMark)); 00409 m_writer.write(value_type(XalanUnicode::charGreaterThanSign)); 00410 } 00411 00412 void 00413 writeCharacters( 00414 const XMLCh* chars, 00415 size_type length) 00416 { 00417 assert(length != 0); 00418 00419 writeParentTagEnd(); 00420 00421 m_indentHandler.setPreserve(true); 00422 00423 size_type i = 0; 00424 size_type firstIndex = 0; 00425 00426 while(i < length) 00427 { 00428 const XalanDOMChar ch = chars[i]; 00429 00430 if(m_charPredicate.range(ch) == true) 00431 { 00432 safeWriteContent(chars + firstIndex, i - firstIndex); 00433 00434 i = writeNormalizedCharBig(chars, i, length); 00435 00436 ++i; 00437 00438 firstIndex = i; 00439 } 00440 else if(m_charPredicate.content(ch) == false) 00441 { 00442 ++i; 00443 } 00444 else 00445 { 00446 safeWriteContent(chars + firstIndex, i - firstIndex); 00447 00448 writeDefaultEscape(ch); 00449 00450 ++i; 00451 00452 firstIndex = i; 00453 } 00454 } 00455 00456 safeWriteContent(chars + firstIndex, i - firstIndex); 00457 00458 m_indentHandler.setPrevText(true); 00459 } 00460 00461 00462 void 00463 writeCDATA( 00464 const XMLCh* chars, 00465 size_type length) 00466 { 00467 assert(length != 0); 00468 00469 writeParentTagEnd(); 00470 00471 m_indentHandler.setPreserve(true); 00472 00473 m_indentHandler.indent(); 00474 00475 m_writer.write( 00476 m_constants.s_cdataOpenString, 00477 m_constants.s_cdataOpenStringLength); 00478 00479 bool outsideCDATA = false; 00480 00481 writeCDATAChars(chars, length, outsideCDATA); 00482 00483 if (outsideCDATA == false) 00484 { 00485 m_writer.write( 00486 m_constants.s_cdataCloseString, 00487 m_constants.s_cdataCloseStringLength); 00488 } 00489 } 00490 00491 /** 00492 * Output a line break. 00493 */ 00494 void 00495 outputNewline() 00496 { 00497 m_writer.outputNewline(); 00498 } 00499 00500 /** 00501 * Escape and write a character. 00502 */ 00503 void 00504 writeDefaultEscape(XalanDOMChar ch) 00505 { 00506 assert(m_charPredicate.content(ch) == true); 00507 00508 if(!writeDefaultEntity(ch)) 00509 { 00510 if (XalanUnicode::charLF == ch) 00511 { 00512 outputNewline(); 00513 } 00514 else 00515 { 00516 if(m_charPredicate.isForbidden(ch) == true) 00517 { 00518 throwInvalidXMLCharacterException( 00519 ch, 00520 m_version, 00521 getMemoryManager()); 00522 } 00523 else 00524 { 00525 writeNumericCharacterReference(ch); 00526 } 00527 } 00528 } 00529 } 00530 00531 /** 00532 * Escape and write a character in an attribute. 00533 */ 00534 void 00535 writeDefaultAttributeEscape(XalanDOMChar ch) 00536 { 00537 assert(m_charPredicate.attribute(ch) == true); 00538 00539 if(writeDefaultAttributeEntity(ch) == false) 00540 { 00541 if(m_charPredicate.isForbidden(ch) == true) 00542 { 00543 throwInvalidXMLCharacterException( 00544 ch, 00545 m_version, 00546 getMemoryManager()); 00547 } 00548 else 00549 { 00550 writeNumericCharacterReference(ch); 00551 } 00552 00553 } 00554 } 00555 00556 /** 00557 * Handle one of the default entities, return false if it 00558 * is not a default entity. 00559 */ 00560 bool 00561 writeDefaultEntity(XalanDOMChar ch) 00562 { 00563 if (XalanUnicode::charLessThanSign == ch) 00564 { 00565 m_writer.write( 00566 m_constants.s_lessThanEntityString, 00567 m_constants.s_lessThanEntityStringLength); 00568 } 00569 else if (XalanUnicode::charGreaterThanSign == ch) 00570 { 00571 m_writer.write( 00572 m_constants.s_greaterThanEntityString, 00573 m_constants.s_greaterThanEntityStringLength); 00574 } 00575 else if (XalanUnicode::charAmpersand == ch) 00576 { 00577 m_writer.write( 00578 m_constants.s_ampersandEntityString, 00579 m_constants.s_ampersandEntityStringLength); 00580 } 00581 else 00582 { 00583 return false; 00584 } 00585 00586 return true; 00587 } 00588 00589 /** 00590 * Handle one of the default entities, return false if it 00591 * is not a default entity. 00592 */ 00593 bool 00594 writeDefaultAttributeEntity(XalanDOMChar ch) 00595 { 00596 if (writeDefaultEntity(ch) == true) 00597 { 00598 return true; 00599 } 00600 else if (XalanUnicode::charQuoteMark == ch) 00601 { 00602 m_writer.write( 00603 m_constants.s_quoteEntityString, 00604 m_constants.s_quoteEntityStringLength); 00605 } 00606 else 00607 { 00608 return false; 00609 } 00610 00611 return true; 00612 } 00613 00614 /** 00615 * Check to see if a parent's ">" has been written, and, if 00616 * it has not, write it. 00617 */ 00618 void 00619 writeParentTagEnd() 00620 { 00621 if(markParentForChildren() == true) 00622 { 00623 m_writer.write(value_type(XalanUnicode::charGreaterThanSign)); 00624 00625 m_indentHandler.setPrevText(false); 00626 00627 m_indentHandler.push_preserve(); 00628 } 00629 } 00630 00631 /** 00632 * Write a normalized character to the stream. 00633 * @param ch the string to write. 00634 * @param start the start offset into the string. 00635 * @param length the length of the string. 00636 */ 00637 size_type 00638 writeNormalizedChar( 00639 XalanDOMChar ch, 00640 const XalanDOMChar chars[], 00641 size_type start, 00642 size_type length) 00643 { 00644 if (XalanUnicode::charLF == ch) 00645 { 00646 outputNewline(); 00647 } 00648 else 00649 { 00650 if(m_charPredicate.isCharRefForbidden(ch)) 00651 { 00652 throwInvalidXMLCharacterException( 00653 ch, 00654 m_version, 00655 getMemoryManager()); 00656 } 00657 else 00658 { 00659 start = m_writer.write( chars, start, length); 00660 } 00661 } 00662 00663 return start; 00664 } 00665 00666 void 00667 writeNumericCharacterReference(unsigned long theNumber) 00668 { 00669 m_writer.write(value_type(XalanUnicode::charAmpersand)); 00670 m_writer.write(value_type(XalanUnicode::charNumberSign)); 00671 00672 m_writer.write(NumberToDOMString(theNumber, m_stringBuffer)); 00673 m_stringBuffer.clear(); 00674 00675 m_writer.write(value_type(XalanUnicode::charSemicolon)); 00676 } 00677 00678 size_type 00679 writeNormalizedCharBig( 00680 const XalanDOMChar chars[], 00681 size_type start, 00682 size_type length) 00683 { 00684 assert(start < length); 00685 00686 const XalanDOMChar ch = chars[start]; 00687 00688 assert(m_charPredicate.range(ch) == true); 00689 00690 if (XMLVersion == XML_VERSION_1_1 && 00691 XalanUnicode::charLSEP == ch) 00692 { 00693 writeNumericCharacterReference(ch); 00694 } 00695 else 00696 { 00697 start = m_writer.write(chars, start, length); 00698 } 00699 00700 return start; 00701 } 00702 00703 /** 00704 * Write characters for a CDATA section 00705 * 00706 * @param ch the string to write. 00707 * @param length the length of the string. 00708 */ 00709 void 00710 writeCDATAChars( 00711 const XalanDOMChar chars[], 00712 size_type length, 00713 bool& outsideCDATA) 00714 { 00715 size_type i = 0; 00716 00717 while(i < length) 00718 { 00719 // If "]]>", which would close the CDATA appears in 00720 // the content, we have to put the first two characters 00721 // in the CDATA section, close the CDATA section, then 00722 // open a new one and add the last character. 00723 00724 const XalanDOMChar theChar = chars[i]; 00725 00726 if (theChar == XalanUnicode::charRightSquareBracket && 00727 i - length > 2 && 00728 XalanUnicode::charRightSquareBracket == chars[i + 1] && 00729 XalanUnicode::charGreaterThanSign == chars[i + 2]) 00730 { 00731 if (outsideCDATA == true) 00732 { 00733 m_writer.write( 00734 m_constants.s_cdataCloseString, 00735 m_constants.s_cdataCloseStringLength); 00736 } 00737 00738 m_writer.write(value_type(XalanUnicode::charRightSquareBracket)); 00739 m_writer.write(value_type(XalanUnicode::charRightSquareBracket)); 00740 00741 m_writer.write( 00742 m_constants.s_cdataCloseString, 00743 m_constants.s_cdataCloseStringLength); 00744 00745 m_writer.write( 00746 m_constants.s_cdataOpenString, 00747 m_constants.s_cdataOpenStringLength); 00748 00749 m_writer.write(value_type(XalanUnicode::charGreaterThanSign)); 00750 00751 outsideCDATA = false; 00752 00753 i += 2; 00754 } 00755 else 00756 { 00757 if (XalanUnicode::charLF == theChar) 00758 { 00759 outputNewline(); 00760 } 00761 else if(m_charPredicate.isCharRefForbidden(theChar)) 00762 { 00763 throwInvalidXMLCharacterException( 00764 theChar, 00765 m_version, 00766 getMemoryManager()); 00767 } 00768 else 00769 { 00770 i = m_writer.writeCDATAChar(chars, i, length, outsideCDATA); 00771 } 00772 } 00773 00774 ++i; 00775 } 00776 00777 if(outsideCDATA == true) 00778 { 00779 m_writer.write( 00780 m_constants.s_cdataOpenString, 00781 m_constants.s_cdataOpenStringLength); 00782 } 00783 } 00784 00785 00786 /** 00787 * Write an attribute string. 00788 * 00789 * @param theString The string to write. 00790 * @param theStringLength The length of the string. 00791 */ 00792 void 00793 writeAttrString( 00794 const XalanDOMChar* theString, 00795 size_type theStringLength) 00796 { 00797 assert(theString != 0); 00798 00799 size_type i = 0; 00800 size_type firstIndex = 0; 00801 00802 while(i < theStringLength) 00803 { 00804 const XalanDOMChar ch = theString[i]; 00805 00806 if(m_charPredicate.range(ch) == true) 00807 { 00808 safeWriteContent(theString + firstIndex, i - firstIndex); 00809 00810 i = writeNormalizedCharBig(theString, i, theStringLength); 00811 00812 ++i; 00813 00814 firstIndex = i; 00815 } 00816 else if (m_charPredicate.attribute(ch) == false) 00817 { 00818 ++i; 00819 } 00820 else 00821 { 00822 safeWriteContent(theString + firstIndex, i - firstIndex); 00823 00824 writeDefaultAttributeEscape(ch); 00825 00826 ++i; 00827 00828 firstIndex = i; 00829 } 00830 } 00831 00832 safeWriteContent(theString + firstIndex, i - firstIndex); 00833 } 00834 00835 private: 00836 00837 /** 00838 * Process an attribute. 00839 * @param name The name of the attribute. 00840 * @param value The value of the attribute. 00841 */ 00842 void 00843 processAttribute( 00844 const XalanDOMChar* name, 00845 const XalanDOMChar* value) 00846 { 00847 m_writer.write(value_type(XalanUnicode::charSpace)); 00848 writeName(name); 00849 m_writer.write(value_type(XalanUnicode::charEqualsSign)); 00850 m_writer.write(value_type(XalanUnicode::charQuoteMark)); 00851 writeAttrString(value, length(value)); 00852 m_writer.write(value_type(XalanUnicode::charQuoteMark)); 00853 } 00854 00855 /** 00856 * Write normalized data. 00857 * @param theData the data to write. 00858 * @param theLength the data to write. 00859 */ 00860 void 00861 writeNormalizedData( 00862 const XalanDOMChar* theData, 00863 size_type theLength) 00864 { 00865 for (size_type i = 0; i < theLength; ++i) 00866 { 00867 const XalanDOMChar theChar = theData[i]; 00868 00869 i = writeNormalizedChar(theChar, theData, i, theLength); 00870 } 00871 } 00872 00873 void 00874 safeWriteContent( 00875 const XalanDOMChar* theChars, 00876 size_type theLength) 00877 { 00878 for(size_type i = 0; i < theLength; ++i) 00879 { 00880 m_writer.write(value_type(theChars[i])); 00881 } 00882 } 00883 00884 void 00885 writeName(const XalanDOMChar* theChars) 00886 { 00887 assert( theChars != 0); 00888 00889 m_writer.writeNameChar(theChars, length(theChars)); 00890 } 00891 00892 private: 00893 00894 // These are not implemented. 00895 FormatterToXMLUnicode(const FormatterToXMLUnicode&); 00896 00897 FormatterToXMLUnicode& 00898 operator=(const FormatterToXMLUnicode&); 00899 00900 bool 00901 operator==(const FormatterToXMLUnicode&) const; 00902 00903 00904 // Data members... 00905 XalanDOMString m_stringBuffer; 00906 00907 UnicodeWriter m_writer; 00908 00909 ConstantsType m_constants; 00910 00911 CharPredicate m_charPredicate; 00912 00913 IndentHandler m_indentHandler; 00914 }; 00915 00916 00917 00918 XALAN_CPP_NAMESPACE_END 00919 00920 00921 00922 #endif // FORMATTERTOXML_UNICODE_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.11 |
|