Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

problem in appending xml element and attribute to existing file

Return to Member Forum

  • Author
    Posts
    • #77999
      Rose Sall
      Member

      hello all,
      I have a xml file which looks something like this:
      <root>
      <element1 attr1=””attr2=””attr3=””>message</element>
      <element1 attr1=””attr2=””attr3=””>message</element>
      </root>

      I want to append “<element1 attr1=””attr2=””attr3=””>message</element>” to the document.
      I am using the code:

      Dim xdoc As New XmlDocument()
      xdoc.Load(xfile)
      Dim xerr As System.Xml.XmlElement = xdoc.CreateElement(“element1”)
      Dim xatttr1 As System.Xml.XmlAttribute = xdoc.CreateAttribute(“attr1”)
      xatttr1.Value = “”
      xerr.Attributes.Append(xatttr1)
      Dim xatttr2 As System.Xml.XmlAttribute = xdoc.CreateAttribute(“attr2”)
      xatttr2.Value = “”
      xerr.Attributes.Append(xatttr2)
      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.
      thanks

Viewing 0 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads