Exemplo n.º 1
0
// htmlReadMemory
func ReadHTMLMemory(buffer []byte, url string, encoding string, options HTMLParserOption) *HTMLDocument {
	ptru := C.CString(url)
	defer C.free_string(ptru)
	ptre := C.CString(encoding)
	defer C.free_string(ptre)
	doc := C.htmlReadMemory((*C.char)(unsafe.Pointer(&buffer[0])), C.int(len(buffer)), ptru, ptre, C.int(options))
	return makeHTMLDoc(doc)
}
Exemplo n.º 2
0
func HtmlReadMemory(buffer string, url string, encoding string, options HtmlParseOptions) unsafe.Pointer {
	cbuffer := C.CString(buffer)
	curl := C.CString(url)
	cencoding := C.CString(encoding)
	cdoc := C.htmlReadMemory(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)
}