Exemple #1
0
func (xmlNode *XmlNode) RecursivelyRemoveNamespaces() (err error) {
	nodePtr := xmlNode.Ptr
	C.xmlSetNs(nodePtr, nil)

	for child := xmlNode.FirstChild(); child != nil; {
		child.RecursivelyRemoveNamespaces()
		child = child.NextSibling()
	}

	nodeType := xmlNode.NodeType()

	if ((nodeType == XML_ELEMENT_NODE) ||
		(nodeType == XML_XINCLUDE_START) ||
		(nodeType == XML_XINCLUDE_END)) &&
		(nodePtr.nsDef != nil) {
		C.xmlFreeNsList((*C.xmlNs)(nodePtr.nsDef))
		nodePtr.nsDef = nil
	}

	if nodeType == XML_ELEMENT_NODE && nodePtr.properties != nil {
		property := nodePtr.properties
		for property != nil {
			if property.ns != nil {
				property.ns = nil
			}
			property = property.next
		}
	}
	return
}
Exemple #2
0
// xmlFreeNsList
func (ns *Namespace) FreeList() {
	C.xmlFreeNsList(ns.Ptr)
	ns.Ptr = nil
}