Xmlwiter anyone can help
-
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;;;;
-
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;;;;
-
Tkml236 wrote:
I want make it recursive;;;;
Sounds like a TreeView might go along with want you want better than a listbox will.
-
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
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!
-
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!
-
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?
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!
-
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!