Beispiel #1
0
func (d *Document) SetEncoding(e string) {
	if d.ptr.encoding != nil {
		C.MY_xmlFree(unsafe.Pointer(d.ptr.encoding))
	}

	d.ptr.encoding = C.xmlStrdup(stringToXmlChar(e))
}
Beispiel #2
0
func (d *Document) SetVersion(e string) {
	if d.ptr.version != nil {
		C.MY_xmlFree(unsafe.Pointer(d.ptr.version))
	}

	d.ptr.version = C.xmlStrdup(stringToXmlChar(e))
}
Beispiel #3
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)
}