00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "Parser.h"
00025
00027
00029
00030 DOMPrintFormatTarget::DOMPrintFormatTarget()
00031 {
00032 outSiz = 16384;
00033 outBuf = new unsigned char [outSiz];
00034 outPtr = 0;
00035 }
00036
00037 DOMPrintFormatTarget::~DOMPrintFormatTarget()
00038 {
00039 }
00040
00041 void DOMPrintFormatTarget::writeChars (const XMLByte* const toWrite,
00042 const unsigned int count, XMLFormatter* const formatter)
00043 {
00044 if (outPtr + count > outSiz) {
00045 outSiz <<= 1;
00046 unsigned char *tmpBuf = new unsigned char [outSiz];
00047 if (outPtr) {
00048 memcpy (tmpBuf, outBuf, outPtr);
00049 }
00050 delete outBuf;
00051 outBuf = tmpBuf;
00052 }
00053 if (outPtr + count > outSiz) {
00054 generalLog->error ("Absurdly large XML encountered!\n");
00055 throw ("Absurdly large XML encountered!\n");
00056 }
00057 memcpy (outBuf + outPtr, toWrite, count);
00058 outPtr += count;
00059 };
00060
00061
00068 ostream& operator<< (ostream& target, const DOMString& s)
00069 {
00070 char *p = s.transcode();
00071 target << p;
00072 delete [] p;
00073 return target;
00074 }
00075
00076