Пример #1
0
// xmlReadMemory
func ReadMemory(buffer []byte, url string, encoding string, options ParserOption) *Document {
	ptru := C.CString(url)
	defer C.free_string(ptru)
	ptre := C.CString(encoding)
	defer C.free_string(ptre)
	doc := C.xmlReadMemory((*C.char)(unsafe.Pointer(&buffer[0])), C.int(len(buffer)), ptru, ptre, C.int(options))
	return makeDoc(doc)
}
Пример #2
0
func XmlReadMemory(buffer string, url string, encoding string, options XmlParseOptions) unsafe.Pointer {
	cbuffer := C.CString(buffer)
	curl := C.CString(url)
	cencoding := C.CString(encoding)
	cdoc := C.xmlReadMemory(cbuffer, C.int(C.strlen(cbuffer)), curl, cencoding, C.int(options))
	C.free(unsafe.Pointer(cbuffer))
	C.free(unsafe.Pointer(curl))
	C.free(unsafe.Pointer(cencoding))
	return unsafe.Pointer(cdoc)
}