How to obtain an xmlBuf for use with xmlBufGetNodeContent/xmlBufNodeDump etc.?

1k views Asked by At

The description of xmlNodeDump() (which takes an xmlBufferPtr) states:

Since this is using xmlBuffer structures it is limited to 2GB and somehow deprecated, use xmlBufNodeDump() instead.

Fair enough, but since xmlBufNodeDump() (and e.g. xmlBufGetNodeContent) takes an xmlBufPtr my question: How to create such an xmlBuf buffer?

I can't find anything obvious.

And how to free it?

I mean, for xmlBuffer there is e.g. xmlBufferCreate().

Or is one supposed to obtain an xmlOutputBuffer via xmlAllocOutputBuffer() and use its xmlOutputBuffer::buffer attribute (of type xmlBuf*) for xmlBufNodeDump()?

1

There are 1 answers

3
Alex On

For those who need an answer:

xmlBufferPtr buffer;
buffer = xmlBufferCreate();

xmlBufPtr buf;
buf = xmlBufFromBuffer(buffer);