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. append node by element name

append node by element name

Scheduled Pinned Locked Moved C#
questioncsharpxml
4 Posts 4 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.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    I have the following xml: how can I add childs to the Contacts using C# but with referring to the by name not by ID? I want to add: my category my contact number

    N C M 3 Replies Last reply
    0
    • J Jassim Rahma

      I have the following xml: how can I add childs to the Contacts using C# but with referring to the by name not by ID? I want to add: my category my contact number

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      At least make some effort http://www.bing.com/search?q=xml+c%23&src=IE-SearchBox&FORM=IE8SRC[^]


      I know the language. I've read a book. - _Madmatt

      1 Reply Last reply
      0
      • J Jassim Rahma

        I have the following xml: how can I add childs to the Contacts using C# but with referring to the by name not by ID? I want to add: my category my contact number

        C Offline
        C Offline
        carlecomm
        wrote on last edited by
        #3

        You can use c# DOM to access the XML or DHMTL. Try this: http://progzoo.net/wiki/C%23:Navigating\_over\_DOM\_Tutorial

        1 Reply Last reply
        0
        • J Jassim Rahma

          I have the following xml: how can I add childs to the Contacts using C# but with referring to the by name not by ID? I want to add: my category my contact number

          M Offline
          M Offline
          Mirko1980
          wrote on last edited by
          #4

          As I already said, look to XPath. If you load your XML into an XmlDocument, you can get the desired contact by doing:

          xmlDoc.SelectSingleNode("/Contacts/Contact[@ID='xxxxxxxxx']");

          Then, you have a reference to the node into which you can add subnodes.

          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