Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. XML Attributes

XML Attributes

Scheduled Pinned Locked Moved C#
questionxml
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ytubis
    wrote on last edited by
    #1

    Hi! I am trying to create an XML Element that has XML attribute and appened it to and existing XML document. how do i do this? Do the prosedure is: 1)create attributes (2 - 3). 2) create Element and attach the attributes? (How?) 3) append to an Element list? Or XMLDoc? (How) Thanks :)

    P S 2 Replies Last reply
    0
    • Y ytubis

      Hi! I am trying to create an XML Element that has XML attribute and appened it to and existing XML document. how do i do this? Do the prosedure is: 1)create attributes (2 - 3). 2) create Element and attach the attributes? (How?) 3) append to an Element list? Or XMLDoc? (How) Thanks :)

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Yep, try it, you'll see.

      1 Reply Last reply
      0
      • Y ytubis

        Hi! I am trying to create an XML Element that has XML attribute and appened it to and existing XML document. how do i do this? Do the prosedure is: 1)create attributes (2 - 3). 2) create Element and attach the attributes? (How?) 3) append to an Element list? Or XMLDoc? (How) Thanks :)

        S Offline
        S Offline
        Spacix One
        wrote on last edited by
        #3
        1. XmlAttribute myAttrib = new XmlAttribute(); myAttrib.Value = "Some value"; 2) on then XmlDocument you opened (I'm going to use xmlDoc as an example) XmlNode myNode = xmlDoc.CreateElement("tagname"); myNode.AppendChild(xmlDoc.CreateTextElement("The tag's text node Value")); 3) use the .AppendChild() as above to attach to the Document node xmlDoc.DocumentElement.AppendChild(myNode); *note* you need to use .Save() to well save the changes/appends

        -Spacix All your skynet questions[^] belong to solved

        Y 1 Reply Last reply
        0
        • S Spacix One
          1. XmlAttribute myAttrib = new XmlAttribute(); myAttrib.Value = "Some value"; 2) on then XmlDocument you opened (I'm going to use xmlDoc as an example) XmlNode myNode = xmlDoc.CreateElement("tagname"); myNode.AppendChild(xmlDoc.CreateTextElement("The tag's text node Value")); 3) use the .AppendChild() as above to attach to the Document node xmlDoc.DocumentElement.AppendChild(myNode); *note* you need to use .Save() to well save the changes/appends

          -Spacix All your skynet questions[^] belong to solved

          Y Offline
          Y Offline
          ytubis
          wrote on last edited by
          #4

          How do i attch the attribute to the new node? is it before i append it? Thanks :)

          S 1 Reply Last reply
          0
          • Y ytubis

            How do i attch the attribute to the new node? is it before i append it? Thanks :)

            S Offline
            S Offline
            Spacix One
            wrote on last edited by
            #5

            look at the .Attributes.Append() method for a XmlNode...


            -Spacix All your skynet questions[^] belong to solved

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups