[xml] xmlNodeDump outut problems




Hi,

Using libxml2 2.6.20, is there any example of using xmlNodeDump?  I've
tried:

///

        int size = 0;
        int tmp  = 0;

        xmlDocPtr psDoc       = NULL;
        xmlNodePtr psRootNode = NULL;
        xmlNodePtr psNode     = NULL;
        xmlBufferPtr psBuf;

        psBuf = xmlBufferCreate();

        psDoc = xmlNewDoc(BAD_CAST "1.0");
        psRootNode = xmlNewNode(NULL, BAD_CAST "BoundingBox");

        xmlDocSetRootElement(psDoc, psRootNode);

        xmlNewProp(psRootNode, BAD_CAST "crs", BAD_CAST crs);
        xmlNewProp(psRootNode, BAD_CAST "dimensions", BAD_CAST
dimensions);

        psNode = xmlNewChild(psRootNode, NULL, BAD_CAST "LowerCorner",
BAD_CAST "foo");
        psNode = xmlNewChild(psRootNode, NULL, BAD_CAST "UpperCorner",
BAD_CAST "foo");

        psBuf = xmlNodeDump(psBuf, psDoc, psRootNode, 0, 1);

        printf("%s", (char *)xmlBufferContent(psBuf));

        xmlBufferFree(psBuf);
        xmlFreeDoc(psDoc);
        xmlCleanupParser();
///

But get seg faults when trying to execute.

Any advice would be appreciated.

Thanks

..Tom




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