[xml] truncated bytes in xml



Hi , 


I am  using libxml2 in an embedded environment . 
I am trying to use the xmlwriter API's to write xml. 

some of the blocks have a sizeable amount of data ( >1000 bytes ) . 
I am using code similar to this to write each node 



xmlNodePtr pDom ; 

..

...

..

..


xmlTextWriterStartElement(writer,(const xmlChar *)kElem1);

xmlTextWriterWriteString(writer , BAD_CAST GetData() ); // line 2 

xmlTextWriterEndElement(writer);


// 2nd element 


// 3rd element 


xmlTextWriterEndDocument(writer);

xmlFreeTextWriter(writer);



//write out xml to file system 

xmlOutputBufferPtr buffptr= xmlOutputBufferCreateIO (WriteCallbackFunction,CloseCallbackFunction, (void *)&file, NULL);

if(buffptr == NULL)

return false

// Buffer Ptr ,doc , currentnode , level , format , encoding 

xmlNodeDumpOutput(buffptr, pDom->doc, pDom , 00, NULL);

if(xmlOutputBufferClose(buffptr))

return true;



the problem is that  data  is missing in the final xml file. 

Part of the data for Node 1 is written but the rest of the nodes are absent 

something like 
<A><B><Elem1>TUlJRFBEQ0NBaVNnQXdJQkFnSUpBdnNYK3dnSEJBQUNNQTBHQ1NxR1NJYjNEUUVCQlFVQU1I
Y3hDekFKQmdOVgpCQVlUQWxWVE1STXdFUVlEVlFRS0V3cEJjSEJzWlNCSmJtTXVNU1l3SkFZ

I have tried replacing the xmlTextWriterWriteString   with other similars API's such as xmlTextWriterWriteRaw and xmlTextWriteWriteBase64 but havent had any success ! 


Is anyone aware of any issues with this or a recommendation for a better way to do this . 

Thanks 






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]