Dumping a DocPtr

It was one of those annoying little things that I figured out how to do once, but couldn’t remember how when it came up this morning on the libxml mailing list: how to dump a document from its native DocPtr structure into a regular old char buffer.

So when Lucas Brasilino pointed out the answer I jotted down a working example and added it to the libxml2 examples (not there at the moment, should show up when the web site syncs).

See, I’m on vacation.