By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

TreeView Data To Xml

P: n/a
Hi,

i would like to save the treeview data (nodes) into an xml file.

how should i do that ?

Thanks.
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Tiraman :-)" <ti*****@netvision.net.il> schrieb
i would like to save the treeview data (nodes) into an xml file.

how should i do that ?


Hi Tiraman,

perhaps serializing is a solution for you:

http://groups.google.com/groups?selm...40cpmsftngxa09

Cheers

Arne Janning
Nov 21 '05 #2

P: n/a
If you just need something simple, try this. Note that this version doesn't
handle characters that must be escaped in XML, and it doesn't add the XML
header to the StringBuilder you're passing (you can append that before
calling the method, if you want it), but it should put you on the right
track. Pass it the TreeNode's root node (someTreeView.Nodes(0)) to save the
whole tree, or any branch node to save that branch.

Private Sub SaveAsXML(ByVal aTreeNode As TreeNode, ByVal sb As
StringBuilder)
sb.Append("<node><text>" & aTreeNode.Text & "</text>")
For Each tn As TreeNode In aTreeNode.Nodes
SaveAsXML(tn, sb)
Next
sb.Append("</node>")
End Sub

"Tiraman :-)" <ti*****@netvision.net.il> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
Hi,

i would like to save the treeview data (nodes) into an xml file.

how should i do that ?

Thanks.

Nov 21 '05 #3

P: n/a
Thanks
I will check this article.

"Arne Janning" <sp*****************@msn.com> wrote in message
news:OC**************@TK2MSFTNGP10.phx.gbl...

"Tiraman :-)" <ti*****@netvision.net.il> schrieb
i would like to save the treeview data (nodes) into an xml file.

how should i do that ?


Hi Tiraman,

perhaps serializing is a solution for you:

http://groups.google.com/groups?selm...40cpmsftngxa09

Cheers

Arne Janning

Nov 21 '05 #4

P: n/a
hi,

Thanks For The Example.

"Russell Jones" <ar**@nospam.northstate.net> wrote in message
news:uR*************@TK2MSFTNGP10.phx.gbl...
If you just need something simple, try this. Note that this version doesn't handle characters that must be escaped in XML, and it doesn't add the XML
header to the StringBuilder you're passing (you can append that before
calling the method, if you want it), but it should put you on the right
track. Pass it the TreeNode's root node (someTreeView.Nodes(0)) to save the whole tree, or any branch node to save that branch.

Private Sub SaveAsXML(ByVal aTreeNode As TreeNode, ByVal sb As
StringBuilder)
sb.Append("<node><text>" & aTreeNode.Text & "</text>")
For Each tn As TreeNode In aTreeNode.Nodes
SaveAsXML(tn, sb)
Next
sb.Append("</node>")
End Sub

"Tiraman :-)" <ti*****@netvision.net.il> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
Hi,

i would like to save the treeview data (nodes) into an xml file.

how should i do that ?

Thanks.


Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.