Beispiel #1
0
func ParseFragment(content, inEncoding, url []byte, options int, outEncoding []byte) (fragment *xml.DocumentFragment, err error) {
	inEncoding = AppendCStringTerminator(inEncoding)
	outEncoding = AppendCStringTerminator(outEncoding)
	document := CreateEmptyDocument(inEncoding, outEncoding)
	fragment, err = parsefragment(document, nil, content, url, options)
	C.xmlDocSetRootElement((*C.xmlDoc)(document.DocPtr()), (*C.xmlNode)(fragment.Node.NodePtr()))
	return
}
Beispiel #2
0
func (d *Document) SetDocumentElement(n Node) {
	C.xmlDocSetRootElement(d.ptr, (*C.xmlNode)(n.pointer()))
	d.root = (*C.xmlNode)(n.pointer())
}
Beispiel #3
0
// xmlDocSetRootElement
func (doc *Document) SetRoot(root *Node) *Node {
	cnode := C.xmlDocSetRootElement(doc.Ptr, root.Ptr)
	return makeNode(cnode)
}