Example #1
0
func HtmlNodeDump(n unsafe.Pointer) string {
	buf := C.xmlBufferCreate()
	C.htmlNodeDump(buf, nil, C.xmlNodePtr(n))
	cstr := C.xmlBufferContent(buf)
	str := C.GoString(xmlCharToC(cstr))
	C.xmlBufferFree(buf)
	return str
}
Example #2
0
func (n *xmlNode) ToString(format int, docencoding bool) string {
	// TODO: Implement htis in C
	buffer := C.xmlBufferCreate()
	defer C.xmlBufferFree(buffer)
	if format <= 0 {
		C.xmlNodeDump(buffer, n.ptr.doc, n.ptr, 0, 0)
	} else {
		oIndentTreeOutput := C.MY_setXmlIndentTreeOutput(1)
		C.xmlNodeDump(buffer, n.ptr.doc, n.ptr, 0, C.int(format))
		C.MY_setXmlIndentTreeOutput(oIndentTreeOutput)
	}
	return xmlCharToString(C.xmlBufferContent(buffer))
}
Example #3
0
// xmlBufferFree
func (buffer *Buffer) Free() {
	C.xmlBufferFree(buffer.Ptr)
	buffer.Ptr = nil
}