Hi All,
Apoligies for my absence, moved house last year.
I am trying to copy an element from an esisting XML file.
For example here is simplified version of this file:
All I am trying to do programmitically is trying to copy the element store where its ID is 1 to a new element store of ID 3 into the existing XML document, like this:
I have not wrote much of the code as yet, all I have is this:
As I understand the object XmlDocument is the correct choice for ths task. But I cannot fathom how to firstly access the element I want and the to iterate through all of this elements nodes and then create this new element in the existing xml document.
Please help?
Thanks, Dave.
Apoligies for my absence, moved house last year.
I am trying to copy an element from an esisting XML file.
For example here is simplified version of this file:
Code:
<Ctrl Name="Customers">
<Group GroupId="1">
<FirstName>"Joe"</FirstName>
<Surname>"Soap"</Surname>
</Group >
<Group Group ="2">
<FirstName>"Joe"</FirstName>
<Surname>"Pope"</Surname>
</Group >
</Ctrl >
Code:
<Ctrl Name="Customers">
<Group GroupId="1">
<FirstName>"Joe"</FirstName>
<Surname>"Soap"</Surname>
</Group >
<Group Group ="2">
<FirstName>"Jane"</FirstName>
<Surname>"Pope"</Surname>
</Group >
<Group GroupId="3">
<FirstName>"Joe"</FirstName>
<Surname>"Soap"</Surname>
</Group >
</Ctrl >
Code:
Dim xmlReader As New XmlTextReader("C:\work\homeTest\source\test.xml")
Dim xmlDoc As New XmlDocument
xmlDoc.Load(xmlReader)
Please help?
Thanks, Dave.