Beispiel #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
}
Beispiel #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))
}
Beispiel #3
0
// xmlBufferFree
func (buffer *Buffer) Free() {
	C.xmlBufferFree(buffer.Ptr)
	buffer.Ptr = nil
}