Question : saving some nodes to existing xml

Hi,

Say I have the following xml:
<xml>
<rootnode>
   <subnodes>  
           <FileName>value 1</FileName>  
           <FileName>value 2</FileName>  
   </subnodes>
</rootnode>

I then load my xml into an xmldocument from an xml file and loop through a list of strings:
Dim filename As String = ""
        Dim xml As String = ""
        Dim xmlDoc As New XmlDocument

        xmlDoc.Load(Application.StartupPath & "\DespatchPrintingConfiguration.xml")

        For Each filename In _lstFileNamesToDelete
            xml = xml & "<FileName>" & filename & "</FileName>"
        Next

I know have some xml nodes that I want to add to my xml in the document and then save the file.

How to I add this section of xml to:
<rootnode>
   <subnodes>  

I'd appreciate a swift response on this one.

Thanks


Answer : saving some nodes to existing xml

perhaps a more complete example:

where you have this line: xml = xml & "<FileName>" & filename & "</FileName>"


you can put:

       Dim xnode as xmlnode = xmldoc.selectsinglenode("rootnode/subnodes")

       For Each filename In _lstFileNamesToDelete
            Dim x As System.Xml.XmlNode = xmlDoc.CreateNode(System.Xml.XmlNodeType.Element, "FileName", "")
            x.InnerText = filename
            xnode.AppendChild(x)
       Next


            
Random Solutions  
 
programming4us programming4us