2014年10月3日 星期五

Write XML

參考引用來源
--
 Sub Main()

      Dim oXML As Xml.XmlDocument
      Dim oNodes As Xml.XmlNode
      Dim oNode As Xml.XmlNode
      Dim sFilename As String = "D:\Junk\foo.xml"

      oXML = New Xml.XmlDocument
      oXML.Load(sFilename)

      oNodes = oXML.DocumentElement

      oNode = oNodes.ChildNodes(0)
      oNode.Item("s1").InnerText = "Pink Floyd"
      oNode.Item("s2").InnerText = "Dark Side of the Moon"
      oNode.Item("s3").InnerText = "1973"

      oNode = oNodes.ChildNodes(1)
      oNode.Item("s1").InnerText = "Deep Purple"
      oNode.Item("s2").InnerText = "Stormbringer"
      oNode.Item("s3").InnerText = "1974"

      oXML.Save(sFilename)

   End Sub

沒有留言:

張貼留言