func (x *XPathContext) Free() { if x.ptr == nil { return } C.xmlXPathFreeContext(x.ptr) }
func (xpath *XPath) Free() { if xpath.ContextPtr != nil { C.xmlXPathFreeContext(xpath.ContextPtr) xpath.ContextPtr = nil } if xpath.ResultPtr != nil { C.xmlXPathFreeObject(xpath.ResultPtr) xpath.ResultPtr = nil } }
func (d *XmlDoc) XPath(xpathExpr string) *XPathResult { context := C.xmlXPathNewContext(d.Ptr) defer C.xmlXPathFreeContext(context) result := C.xmlXPathEvalExpression(stringToXmlChar(xpathExpr), context) fmt.Println("XPath: ", xpathExpr, " Type: ", result._type, " Result: ", result) return &XPathResult{ptr: result} }
func (xpath *XPath) Free() { if xpath.ContextPtr != nil { ClearScope(unsafe.Pointer(xpath.ContextPtr)) C.xmlXPathFreeContext(xpath.ContextPtr) xpath.ContextPtr = nil } if xpath.ResultPtr != nil { C.xmlXPathFreeObject(xpath.ResultPtr) xpath.ResultPtr = nil } }
func (n *XmlNode) XPath(xpathExpr string) *XPathResult { context := C.xmlXPathNewContext((C.xmlDocPtr)(unsafe.Pointer(n.Ptr.doc))) context.node = n.Ptr defer C.xmlXPathFreeContext(context) result := C.xmlXPathEvalExpression(stringToXmlChar(xpathExpr), context) fmt.Println("XPath: ", xpathExpr, " Type: ", result._type, " Result: ", result) return &XPathResult{ptr: result} }
// xmlXPathFreeContext func (ctx *XPathContext) Free() { C.xmlXPathFreeContext(ctx.Ptr) ctx.Ptr = nil }
// Free the libxml2 allocated objects func (xp *HtmlXp) free() { C.xmlXPathFreeContext(xp.xpathCtx) xp.xpathCtx = nil C.xmlFreeDoc(xp.doc) xp.doc = nil }
// Free a xmlPathContext, but not the document func (xp *Xp) freexpathCtx() { C.xmlXPathFreeContext(xp.xpathCtx) xp.xpathCtx = nil xp.doc = nil xp.master = nil }