![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Appending to an XML file Hi I'm trying to modify an XML file using vbscript; editing an item between 2 elements. I've manged to get my script to delete the old entries, but whenever I try and add my test entry between the selected elements, it adds the entry at the very end of the XML file! Option explicit Dim oldnode, objXML, newXML, x, y Set objXML = CreateObject("Microsoft.XMLDOM") with objXML .Load("machine.xml") End with ' Find the node to be deleted Set oldnode = objXML.documentElement.selectSingleNode("//quarantineManager/actions") with oldnode .parentnode.removeChild(oldnode) End with Set newXML = objXML.createElement("New_Tag") Set y = objXML.documentElement Set x = y.getElementsByTagName("quarantineManager") y.appendChild(newXML) objXML.save ("machineNew.xml") |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Appending to an XML file Neil wrote: Quote: > I've manged to get my script to delete the old entries, but whenever Quote: > and add my test entry between the selected elements, it adds the entry at the > very end of the XML file! > Try using the "InsertBefore" method. Or, rather than the delete+add approach, modify the node you have. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Vista Appending Computer-name | Network & Sharing | |||
| Appending permissions to Access control lists | PowerShell | |||
| appending/writing to a file | VB Script | |||
| invoke-expression not appending | PowerShell | |||
| Problems with appending DNS suffix for name resolution | Vista networking & sharing | |||