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))}, }, } }
func XmlGetProp(n unsafe.Pointer, name string) string { cname := C.CString(name) cstr := C.xmlGetProp(C.xmlNodePtr(n), cToXmlChar(cname)) str := C.GoString(xmlCharToC(cstr)) C.free(unsafe.Pointer(cname)) return str }
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 }
func makeDoc(doc C.xmlDocPtr) *Document { if doc == nil { return nil } return &Document{ Ptr: doc, Node: makeNode(C.xmlNodePtr(unsafe.Pointer(doc))), } }
func (e *XmlElement) Type() ElementType { node_type := C.xmlNodePtr(e.ptr)._type return ElementType(node_type) }
func (e *XmlElement) Name() string { node := unsafe.Pointer(C.xmlNodePtr(e.ptr).name) name := C.GoString((*C.char)(node)) return name }
// NodeSetContent sets the content of a node (or attribute) func (xp *Xp) NodeSetContent(node *C.xmlNode, content string) { Ccontent := unsafe.Pointer(C.CString(content)) C.xmlNodeSetContent(C.xmlNodePtr(node), (*C.xmlChar)(Ccontent)) C.free(Ccontent) }
// NodeSetName sets the name/tag of a node func (xp *Xp) NodeSetName(node *C.xmlNode, name string) { Cname := unsafe.Pointer(C.CString(name)) C.xmlNodeSetName(C.xmlNodePtr(node), (*C.xmlChar)(Cname)) C.free(Cname) }
func XmlNextElementSibling(n unsafe.Pointer) unsafe.Pointer { return unsafe.Pointer(C.xmlNextElementSibling(C.xmlNodePtr(n))) }
func XmlFirstElementChild(n unsafe.Pointer) unsafe.Pointer { return unsafe.Pointer(C.xmlFirstElementChild(C.xmlNodePtr(n))) }