Пример #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
}
Пример #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))
}
Пример #3
0
// xmlBufferCreate
func NewBuffer() *Buffer {
	return &Buffer{C.xmlBufferCreate()}
}