MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlFreeNode

Function xmlFreeNode

ThirdParty/libxml2/vtklibxml2/tree.c:3737–3794  ·  view source on GitHub ↗

* xmlFreeNode: * @cur: the node * * Free a node including all the children. * * This doesn't unlink the node from the tree. Call xmlUnlinkNode first * unless @cur is a root node. */

Source from the content-addressed store, hash-verified

3735 * unless @cur is a root node.
3736 */
3737void
3738xmlFreeNode(xmlNodePtr cur) {
3739 xmlDictPtr dict = NULL;
3740
3741 if (cur == NULL) return;
3742
3743 /* use xmlFreeDtd for DTD nodes */
3744 if (cur->type == XML_DTD_NODE) {
3745 xmlFreeDtd((xmlDtdPtr) cur);
3746 return;
3747 }
3748 if (cur->type == XML_NAMESPACE_DECL) {
3749 xmlFreeNs((xmlNsPtr) cur);
3750 return;
3751 }
3752 if (cur->type == XML_ATTRIBUTE_NODE) {
3753 xmlFreeProp((xmlAttrPtr) cur);
3754 return;
3755 }
3756 if (cur->type == XML_ENTITY_DECL) {
3757 xmlFreeEntity((xmlEntityPtr) cur);
3758 return;
3759 }
3760
3761 if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
3762 xmlDeregisterNodeDefaultValue(cur);
3763
3764 if (cur->doc != NULL) dict = cur->doc->dict;
3765
3766 if ((cur->children != NULL) &&
3767 (cur->type != XML_ENTITY_REF_NODE))
3768 xmlFreeNodeList(cur->children);
3769
3770 if ((cur->type == XML_ELEMENT_NODE) ||
3771 (cur->type == XML_XINCLUDE_START) ||
3772 (cur->type == XML_XINCLUDE_END)) {
3773 if (cur->properties != NULL)
3774 xmlFreePropList(cur->properties);
3775 if (cur->nsDef != NULL)
3776 xmlFreeNsList(cur->nsDef);
3777 } else if ((cur->content != NULL) &&
3778 (cur->type != XML_ENTITY_REF_NODE) &&
3779 (cur->content != (xmlChar *) &(cur->properties))) {
3780 DICT_FREE(cur->content)
3781 }
3782
3783 /*
3784 * When a node is a text node or a comment, it uses a global static
3785 * variable for the name of the node.
3786 * Otherwise the node name might come from the document's dictionary
3787 */
3788 if ((cur->name != NULL) &&
3789 (cur->type != XML_TEXT_NODE) &&
3790 (cur->type != XML_COMMENT_NODE))
3791 DICT_FREE(cur->name)
3792
3793 xmlFree(cur);
3794}

Callers 15

parseFileFunction · 0.85
xmlValidGetValidElementsFunction · 0.85
xmlSAX2StartElementFunction · 0.85
xmlSAX2StartElementNsFunction · 0.85
xmlTextReaderDumpCopyFunction · 0.85
xmlTextReaderCloseFunction · 0.85
xmlFreeDtdFunction · 0.85
xmlNewDocPIFunction · 0.85
xmlNewDocRawNodeFunction · 0.85
xmlNewTextFunction · 0.85
xmlNewReferenceFunction · 0.85
xmlNewTextLenFunction · 0.85

Calls 7

xmlFreeDtdFunction · 0.85
xmlFreeNsFunction · 0.85
xmlFreePropFunction · 0.85
xmlFreeEntityFunction · 0.85
xmlFreeNodeListFunction · 0.85
xmlFreePropListFunction · 0.85
xmlFreeNsListFunction · 0.85

Tested by

no test coverage detected