[xml] How to use c14n features?


I'm in first use of libxml2 and want to use c14n features in "c14n.h". I tried to find some references to use them but couldn't make it.
Can you please tell me where to get it or help me to use it?

With my poor inspection, it seems that `xmlC14NExecute()` is actually in charge of c14n but I don't know how to properly create `xmlC14NIsVisibleCallback`. I created the callback which always return true like following:

auto doc = xmlParseFile(R"(C:\BIN\temp\xml\SOAP\Soap.xml)");
auto node = xmlDocGetRootElement(doc);
xmlBufferPtr buffer = xmlBufferCreate();
xmlOutputBufferPtr outbuf = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));

xmlC14NIsVisibleCallback callback = [](void * userdata, xmlNodePtr node, xmlNodePtr parent)->int { return true; };
xmlC14NExecute(doc, callback, node, 0, nullptr, true, outbuf);
After calling xmlC14NExecute, the exception pops and the program crashed and it seems to be out of access violation.

Please forgive my ignorance of basic usage of libxml2, but it would be so grateful if you help me to make this out.

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