Exemplo n.º 1
0
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)
}
Exemplo n.º 2
0
// 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)
}
Exemplo n.º 3
0
func (d *Document) String() string {
	var xc *C.xmlChar
	i := C.int(0)
	C.xmlDocDumpMemory(d.ptr, &xc, &i)
	return xmlCharToString(xc)
}