المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to Delete A Node with its all Child in XML File ?



C++ Programming
12-23-2011, 02:54 PM
Hello Friends
I am writing a XMl file using MSXML.
Some of nodes are having child.When I am rewriting the same node then first I am deleting the node And All its child one by one like this :

void fnDeleteChildNode(MSXML::IXMLDOMNodePtr pMainNode) { MSXML::IXMLDOMNodePtr pChild,pDeletedNodePtr; MSXML::IXMLDOMNodeListPtr pChildList = pMainNode->GetchildNodes(); int noOfChild = pChildList->Getlength(); if(noOfChild > 0) { for(pChild = pMainNode->firstChild; pChild != NULL; pChild = pDeletedNodePtr) { pDeletedNodePtr = pChild->nextSibling; pMainNode->removeChild(pMainNode->firstChild); } } }
But I dont want to delete its child one by one.I want to know is there any fn tht will directly delete all of its child ?

Thanks In Advance.
Regards
Yogesh