func dumpDoc(doc *C.xmlDoc) []byte { var buffer *C.xmlChar var bufferSize C.int C.xmlDocDumpMemory(doc, &buffer, &bufferSize) defer C.MY_xmlFree(unsafe.Pointer(buffer)) return C.GoBytes(unsafe.Pointer(buffer), bufferSize) }
// dump the xml - pretty makes it readable ie. withindent func (xp *Xp) dump(pretty int) string { var buffer *C.xmlChar var size C.int if pretty == 0 { C.xmlDocDumpMemory(xp.doc, &buffer, &size) } else { C.xmlDocDumpFormatMemory(xp.doc, &buffer, &size, C.int(pretty)) } defer C.free(unsafe.Pointer(buffer)) p := (*C.char)(unsafe.Pointer(buffer)) return C.GoString(p) }
func (d *Document) String() string { var xc *C.xmlChar i := C.int(0) C.xmlDocDumpMemory(d.ptr, &xc, &i) return xmlCharToString(xc) }