Beispiel #1
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 #2
0
func XmlNodeDump(n unsafe.Pointer) string {
	buf := C.xmlBufferCreate()
	C.xmlNodeDump(buf, nil, C.xmlNodePtr(n), 0, 0)
	cstr := C.xmlBufferContent(buf)
	str := C.GoString(xmlCharToC(cstr))
	C.xmlBufferFree(buf)
	return str
}
Beispiel #3
0
// xmlNodeDump
func (doc *Document) NodeDump(buf *Buffer, cur *Node, level int, format int) int {
	return int(C.xmlNodeDump(buf.Ptr, doc.Ptr, cur.Ptr, C.int(level), C.int(format)))
}