Dave, I am using the XMLFormatter to dump encoded XML data to a file. This XMLFormatter takes an object of a class XMLFormatTarget as constructor arguement. I have derived a class from XMLFormatTarget and overriden one of its member function writeChars(const XMLByte* const toWrite). When I write some xml content through XMLFormatter, it in turn calls the writeChars(..) function of XMLFormatTarget. As writeChars() does not take an argument which represents the size of the XMLByte array, without getting the size of the XMLByte* from the caller I feel it may not be pssible to recover the size of the XMLByte array within the function writeChars(). I feel, if we change the signature to writeChars(const XMLByte* const toWrite, unsigned int size=0) instead of the existing function writeChars(const XMLByte* const toWrite), then things will work.
If you have any other alternative, please let me know. Regards, Indrajit David_N_Bertoni@lotus.com wrote: > > Perhaps your code is not taking into account that a 16-bit encoding is > likely to have embedded 0 bytes? That will certainly stop C-style strings > from being written correctly. Also, you must write to a stream opened for > binary access, not text. > > Dave > > > Indrajit Chaudhuri > <[EMAIL PROTECTED] To: xercesdev <[EMAIL > PROTECTED]> > bal.co.in> cc: (bcc: David N > Bertoni/CAM/Lotus) > Subject: Problem with > languague encoding in Xerces C Parser 1.2.0a > 09/22/2000 03:12 > AM > Please respond to > xerces-dev > > > > Hi, > > I was trying to parse a XML file with encoding UTF-8 and print it to a > file with encoding UTF-16[BL]E using the DOMPrint Example given with > the sample. I am using NT version of Xerces C Parser 1.2.0. But the > output is not a valid a XML. I feel that some portion of the data are > truncated out. > > For example my input file was > > <?xml version='1.0' encoding="utf-8" ?> > <tag1> > <tag11 attr1="id" > > <tag111> abc </tag111> > </tag11> > </tag1> > > I got the following output with UTF-16LE > > <1"U" > <t> > <t a="i"> > <t> <t> > <t> > <t> > > With UTF-16LE encoding, I am not at all getting a output. > > Could anybody put some light on this matter. > > Regards, > Indrajit