0 Replies Latest reply on Sep 9, 2015 6:00 AM by aviR

    problem appending xml element and attribute to existing file

    aviR Level 1

      hello all,

      I have a xml file which looks something like this:


      <element1 attr1=""attr2=""attr3="">message</element>

      <element1 attr1=""attr2=""attr3="">message</element>



      I want to append "<element1 attr1=""attr2=""attr3="">message</element>" to the document.

      I am using the code:


      Dim xdoc As New XmlDocument()


      Dim xerr As System.Xml.XmlElement = xdoc.CreateElement("element1")

      Dim xatttr1 As System.Xml.XmlAttribute = xdoc.CreateAttribute("attr1")

      xatttr1.Value = ""


      Dim xatttr2 As System.Xml.XmlAttribute = xdoc.CreateAttribute("attr2")

      xatttr2.Value = ""


      Dim xatttr3 As System.Xml.XmlAttribute = xdoc.CreateAttribute("attr3")

      xatttr3 .Value = ""

      xerr.Attributes.Append(xatttr3 )

      end function()


      But this is not giving any output or error. My xml file is left as it is.

      Please tell me where and what is going wrong?

      Please help.