MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlBufNodeDump

Function xmlBufNodeDump

ThirdParty/libxml2/vtklibxml2/xmlsave.c:2479–2520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2477 */
2478
2479size_t
2480xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
2481 int format)
2482{
2483 size_t use;
2484 size_t ret;
2485 xmlOutputBufferPtr outbuf;
2486 int oldalloc;
2487
2488 xmlInitParser();
2489
2490 if (cur == NULL) {
2491 return ((size_t) -1);
2492 }
2493 if (buf == NULL) {
2494 return ((size_t) -1);
2495 }
2496 outbuf = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));
2497 if (outbuf == NULL) {
2498 xmlSaveErrMemory(NULL);
2499 return ((size_t) -1);
2500 }
2501 memset(outbuf, 0, (size_t) sizeof(xmlOutputBuffer));
2502 outbuf->buffer = buf;
2503 outbuf->encoder = NULL;
2504 outbuf->writecallback = NULL;
2505 outbuf->closecallback = NULL;
2506 outbuf->context = NULL;
2507 outbuf->written = 0;
2508
2509 use = xmlBufUse(buf);
2510 oldalloc = xmlBufGetAllocationScheme(buf);
2511 xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT);
2512 xmlNodeDumpOutput(outbuf, doc, cur, level, format, NULL);
2513 xmlBufSetAllocationScheme(buf, oldalloc);
2514 if (outbuf->error)
2515 ret = (size_t) -1;
2516 else
2517 ret = xmlBufUse(buf) - use;
2518 xmlFree(outbuf);
2519 return (ret);
2520}
2521
2522/**
2523 * xmlElemDump:

Callers 1

xmlNodeDumpFunction · 0.85

Calls 6

xmlInitParserFunction · 0.85
xmlSaveErrMemoryFunction · 0.85
xmlBufUseFunction · 0.85
xmlNodeDumpOutputFunction · 0.85

Tested by

no test coverage detected