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 Treeview

XML Treeview

Scheduled Pinned Locked Moved C#
xmlquestion
3 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.
  • P Offline
    P Offline
    PHDENG81
    wrote on last edited by
    #1

    I know this one is going to be a hard one. I need to populate a treeview with an XML file. I also need to save the contents of that same treeview to an XML file. The contents inside of the treeview will be user driven. Therefore, the number of entries within the XML file will never be absolute. I need some kinda of dynamic loader and exporter. Any ideas? I have searched all over the web, but I have yet to find what I am looking for. Thanks in advance. P

    L T 2 Replies Last reply
    0
    • P PHDENG81

      I know this one is going to be a hard one. I need to populate a treeview with an XML file. I also need to save the contents of that same treeview to an XML file. The contents inside of the treeview will be user driven. Therefore, the number of entries within the XML file will never be absolute. I need some kinda of dynamic loader and exporter. Any ideas? I have searched all over the web, but I have yet to find what I am looking for. Thanks in advance. P

      L Offline
      L Offline
      lmoelleb
      wrote on last edited by
      #2

      It is unclear if you are talking about a specific XML format, or XML files in general. Anyway, this should work: Load the XML file into an XmlDocument and walk though it adding tree nodes as you encounter elements. You can also use an XML loader, which might be better for large files. Is it a specific XML format you might be better of with a data mapper able to serialize and deserialize the XML into an object model. Be careful when populating a tree with many nodes - it can be a performance problem - it might be better to add the child nodes "on demand" as the tree is expanded. For writing, walk though your tree and write to an XML Writer (or build a new XmlDocument, then save that)

      1 Reply Last reply
      0
      • P PHDENG81

        I know this one is going to be a hard one. I need to populate a treeview with an XML file. I also need to save the contents of that same treeview to an XML file. The contents inside of the treeview will be user driven. Therefore, the number of entries within the XML file will never be absolute. I need some kinda of dynamic loader and exporter. Any ideas? I have searched all over the web, but I have yet to find what I am looking for. Thanks in advance. P

        T Offline
        T Offline
        tarasn
        wrote on last edited by
        #3

        This article(http://www.codeproject.com/csharp/treecollection.asp[^]) can help you manipulate your treeview.I used the tree collection described in above article to add ,save and load tree nodes ... Very useful. DevIntelligence.com - My blog for .Net Developers

        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