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. Xmlwiter anyone can help

Xmlwiter anyone can help

Scheduled Pinned Locked Moved C#
helpxml
7 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.
  • T Offline
    T Offline
    Tkml236
    wrote on last edited by
    #1

    Helloo all am using xmltextWriter to write node in xml file XmltextWriter w=null w=new Xmltextwriter(-----); but the problem not in using writer the problem is I have listbox have this values ---------- Level1 Level2 Level2 Level2 Level3 Level3 Level1 Level2 Level3 Level4 Level2 Level2 ----------- and soon on i want to make witer get values for list and write it to xml every level1 present base node(root node) and sublevels is subnodes i want be unlimeted level xml file show be appear like this I want make it recursive;;;;

    J 1 Reply Last reply
    0
    • T Tkml236

      Helloo all am using xmltextWriter to write node in xml file XmltextWriter w=null w=new Xmltextwriter(-----); but the problem not in using writer the problem is I have listbox have this values ---------- Level1 Level2 Level2 Level2 Level3 Level3 Level1 Level2 Level3 Level4 Level2 Level2 ----------- and soon on i want to make witer get values for list and write it to xml every level1 present base node(root node) and sublevels is subnodes i want be unlimeted level xml file show be appear like this I want make it recursive;;;;

      J Offline
      J Offline
      J 0
      wrote on last edited by
      #2

      Tkml236 wrote:

      I want make it recursive;;;;

      Sounds like a TreeView might go along with want you want better than a listbox will.

      T 1 Reply Last reply
      0
      • J J 0

        Tkml236 wrote:

        I want make it recursive;;;;

        Sounds like a TreeView might go along with want you want better than a listbox will.

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

        no ...data is stored in listbox (my real problem is stored in othere place but i simplifeid the problem to me clear) i went to get data and write it in XML

        A 1 Reply Last reply
        0
        • T Tkml236

          no ...data is stored in listbox (my real problem is stored in othere place but i simplifeid the problem to me clear) i went to get data and write it in XML

          A Offline
          A Offline
          Arjun Mjolnir Bahree
          wrote on last edited by
          #4

          It's easy. In this routine, you will iterate throught the items in the listbox, fetching their values one by one. Now i assume that you are getting the info on which list-item is a child and which is a parent from the value of the listbox item. In that case, you need to assign all items in the list box with a unique level number (depending on their nesting in the XML). Based on this, when you iterate through items in the list box, you would know which item to nest under which node and at which level. It won't help much by trying to make this recursive. Keep it simple and straight. Any by the way, it's pretty hard understanding your written english :) Please be a little more clearer with your questions.

          Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!

          T 1 Reply Last reply
          0
          • A Arjun Mjolnir Bahree

            It's easy. In this routine, you will iterate throught the items in the listbox, fetching their values one by one. Now i assume that you are getting the info on which list-item is a child and which is a parent from the value of the listbox item. In that case, you need to assign all items in the list box with a unique level number (depending on their nesting in the XML). Based on this, when you iterate through items in the list box, you would know which item to nest under which node and at which level. It won't help much by trying to make this recursive. Keep it simple and straight. Any by the way, it's pretty hard understanding your written english :) Please be a little more clearer with your questions.

            Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!

            T Offline
            T Offline
            Tkml236
            wrote on last edited by
            #5

            ok..how can I solve this problem if I have unlimeted nested levels for level1 please see the example it will be clear for you?

            A 1 Reply Last reply
            0
            • T Tkml236

              ok..how can I solve this problem if I have unlimeted nested levels for level1 please see the example it will be clear for you?

              A Offline
              A Offline
              Arjun Mjolnir Bahree
              wrote on last edited by
              #6

              As I said.... If you have unlimited nested levels for level 1, keep on making a list of all the nestings that you have already written in a stringdictionary or so. the key wud be level number and value would be name, in the StringDict. This list will kee on growing as your list size. if ur list item is unlimited, recursive is a real bad idea since it will give you stack overflow soon enough. Putting in a bit of logic to use a normal collection instead of a recursive stack is a much much better idea for unlimited list items.

              Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!

              T 1 Reply Last reply
              0
              • A Arjun Mjolnir Bahree

                As I said.... If you have unlimited nested levels for level 1, keep on making a list of all the nestings that you have already written in a stringdictionary or so. the key wud be level number and value would be name, in the StringDict. This list will kee on growing as your list size. if ur list item is unlimited, recursive is a real bad idea since it will give you stack overflow soon enough. Putting in a bit of logic to use a normal collection instead of a recursive stack is a much much better idea for unlimited list items.

                Excelsior Arjun Bahree "By The Might of Mjolnir" I Came! I Coded! I Conquered!

                T Offline
                T Offline
                Tkml236
                wrote on last edited by
                #7

                but how can I do that ...did you use xmlTextWriter? I want to use it for writing in xml???

                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