Revision 5f28a7bf include/ObjectXML.h

View differences:

include/ObjectXML.h
316 316
     */
317 317
    friend std::ostream& operator<<(std::ostream& os, ObjectXML& oxml)
318 318
    {
319
        xmlChar * mem;
320
        int       size;
319
        xmlNodePtr root_node = xmlDocGetRootElement(oxml.xml);
321 320

  
322
        xmlDocDumpMemory(oxml.xml,&mem,&size);
321
        if ( root_node == 0 )
322
        {
323
            return os;
324
        }
325

  
326
        xmlBufferPtr buffer = xmlBufferCreate();
327

  
328
        xmlNodeDump(buffer, oxml.xml, root_node, 0, 0);
323 329

  
324
        std::string str(reinterpret_cast<char *>(mem));
330
        std::string str(reinterpret_cast<char *>(buffer->content));
325 331
        os << str;
326 332

  
327
        xmlFree(mem);
333
        xmlBufferFree(buffer);
328 334

  
329 335
        return os;
330 336
    };

Also available in: Unified diff