Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Xmldom.removechild()
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01385022
Message ID:
01385032
Views:
59
This message has been marked as the solution to the initial question of the thread.
Works for me. What is different in your case?
CLEAR
PUBLIC loXMLDoc AS Msxml2.DOMDocument.4.0

TEXT TO lcXml NOSHOW
<names>
   <name>Alice</name>
   <name>Bert</name>
   <name>Charlie</name>
   <name>Diane</name>
   <name>Eric</name>
</names>
ENDTEXT
lcXmlFIle = FULLPATH("names.xml")
lcNewXmlFile = FULLPATH("names2.xml")

ERASE (lcXmlFIle) 
ERASE (lcNewXmlFile)

STRTOFILE(lcXml, lcXmlFIle) 

loXMLDoc = CREATEOBJECT("Msxml2.DOMDocument.4.0")
loXMLDoc.async = .F.
loXMLDoc.load("names.xml")

loRoot = loXMLDoc.documentElement

loChild = loRoot.childNodes.item(2)
loExNode = loRoot.removeChild(loChild)

loNodeList = loXMLDoc.getElementsByTagName("name")
FOR EACH loElem IN loNodeList
   ? loElem.firstChild.nodeValue
ENDFOR

loXMLDoc.Save(lcNewXmlFile)

MODIFY FILE (lcNewXmlFile)
>
>I am using the ms xmldom utility to create and manipulate xml data. It's works great. What I am having trouble with right now is removechild().
>
>If I want to delete a node completely loRoot.RemoveChild(oChildNode) works in that i can check the node count and it has successfully reduced by 1. However when I finally save() the contents of the whole object to file, the deleted node is still present!
>
>What am missing? If I change existing attribute values and save the changes persist.
>
>Any help will be much appreciated
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform