Create new node from selected node
Public Class Example7 Shared Sub Main Dim doc As System.Xml.XmlDocument Dim editor As System.Xml.XPath.XPathNavigator Dim writer As System.Xml.XmlWriter doc = New System.Xml.XmlDocument() doc.Load("pubs.xml") editor = doc.CreateNavigator.SelectSingleNode("/pubs") writer = editor.AppendChild() writer.WriteStartElement("publishers") writer.WriteAttributeString("pub_id", "1234") writer.WriteAttributeString("pub_name", "new name") writer.WriteEndElement() writer.Close() doc.Save("output.xml") End Sub End Class
1. | Get Elements By Tag Name and Loop through Nodes | ||
2. | Read Xml with XmlDocument and XmlNodeReader |