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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Parsing XML

Parsing XML

Scheduled Pinned Locked Moved C#
data-structuresxmljsonhelp
2 Posts 2 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.
  • V Offline
    V Offline
    Vipin Venugopal
    wrote on last edited by
    #1

    Can anybody help in getting the node name and node value from a XML to two arrays that is nodename in one array and node value in another array. even if there is no value for a particular node then also the array of the nodename should be there in one array and the other array should be empty. Vipin

    A 1 Reply Last reply
    0
    • V Vipin Venugopal

      Can anybody help in getting the node name and node value from a XML to two arrays that is nodename in one array and node value in another array. even if there is no value for a particular node then also the array of the nodename should be there in one array and the other array should be empty. Vipin

      A Offline
      A Offline
      Andrei Ungureanu
      wrote on last edited by
      #2

      Hi, I wrote down an example with 2 array lists that contain the name and the values of the nodes. It is very important that in this case the XML should be like this: value1 I hope it fits your needs. XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlstring); doc.Load(xmlfile); ArrayList nodeName = new ArrayList(); ArrayList nodeValue = new ArrayList(); XmlNodeList list = doc.DocumentElement.ChildNodes; foreach(XmlNode node in list) { nodeName.Add(node.Name); nodeValue.Add(node.InnerText); } -- modified at 7:24 Wednesday 9th August, 2006 Do your best to be the best

      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