Beispiel #1
0
func XmlNewDocRawNode(doc unsafe.Pointer, ns unsafe.Pointer, name string, content string) unsafe.Pointer {
	cname := cToXmlChar(C.CString(name))
	ccontent := cToXmlChar(C.CString(content))
	cnode := C.xmlNewDocRawNode(C.xmlDocPtr(doc), C.xmlNsPtr(ns), cname, ccontent)
	C.free(unsafe.Pointer(cname))
	C.free(unsafe.Pointer(ccontent))
	return unsafe.Pointer(cnode)
}
Beispiel #2
0
// xmlNodeListGetString
func (node *Node) ListGetString(inLine bool) string {
	ptr := node.Ptr
	docptr := C.xmlDocPtr((*C.xmlDoc)(ptr.doc))
	cInLine := C.int(0)
	if inLine {
		cInLine = C.int(1)
	}
	str := C.to_charptr(C.xmlNodeListGetString(docptr, ptr, cInLine))
	defer C.free_string(str)
	return C.GoString(str)
}
Beispiel #3
0
func makeHTMLDoc(doc C.htmlDocPtr) *HTMLDocument {
	if doc == nil {
		return nil
	}
	return &HTMLDocument{
		Ptr: doc,
		Document: &Document{
			Ptr:  C.xmlDocPtr(doc),
			Node: &Node{C.xmlNodePtr(unsafe.Pointer(doc))},
		},
		HTMLNode: &HTMLNode{
			Ptr:  C.htmlNodePtr(unsafe.Pointer(doc)),
			Node: &Node{C.xmlNodePtr(unsafe.Pointer(doc))},
		},
	}
}
Beispiel #4
0
func XmlDocGetRootElement(doc unsafe.Pointer) unsafe.Pointer {
	cnode := C.xmlDocGetRootElement(C.xmlDocPtr(doc))
	return unsafe.Pointer(cnode)
}