Пример #1
0
func (x *XPathContext) Free() {
	if x.ptr == nil {
		return
	}

	C.xmlXPathFreeContext(x.ptr)
}
Пример #2
0
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
	}
}
Пример #3
0
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}
}
Пример #4
0
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
	}
}
Пример #5
0
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}
}
Пример #6
0
// xmlXPathFreeContext
func (ctx *XPathContext) Free() {
	C.xmlXPathFreeContext(ctx.Ptr)
	ctx.Ptr = nil
}
Пример #7
0
// Free the libxml2 allocated objects
func (xp *HtmlXp) free() {
	C.xmlXPathFreeContext(xp.xpathCtx)
	xp.xpathCtx = nil
	C.xmlFreeDoc(xp.doc)
	xp.doc = nil
}
Пример #8
0
// Free a xmlPathContext, but not the document
func (xp *Xp) freexpathCtx() {
	C.xmlXPathFreeContext(xp.xpathCtx)
	xp.xpathCtx = nil
	xp.doc = nil
	xp.master = nil
}