468,272 Members | 2,149 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

XML to treeview

Hi there

I have an XML file that looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Node xmlns="Level 1">
<Node xmlns="Level 2A">
</Node>
<Node xmlns="Level 2B">
<Node xmlns="Level 3A">
</Node>
</Node>
</Node>

I want to load this XML file into a TreeView component so it looks something
like this:

- Level 1
- Level 2A
- Level 2B
- Level 3A

I have tried alot of solutions on the internet, but most of them add extra
nodes to the treeview for each XMLNode they find. In the above example I
just want to add the 4 nodes into the treeview, not more.

Regards

/PZ

Feb 21 '06 #1
3 4574

Preben Zacho wrote:
I want to load this XML file into a TreeView component


Which TreeView do you want to use, the one for Windows applications in
System.Windows.Forms or the one for ASP.NET 2.0 applications in
System.Web.UI.WebControls?

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 21 '06 #2


Preben Zacho wrote:
I want to load this XML file into a TreeView component so it looks something
like this:

- Level 1
- Level 2A
- Level 2B
- Level 3A


With ASP.NET 2.0 and its TreeView here is how it is possible

<asp:XmlDataSource
ID="XmlDataSource1"
runat="server"
DataFile="file.xml" ></asp:XmlDataSource>

<asp:TreeView
id="TreeView1"
runat="server"
DataSourceID="XmlDataSource1">
<DataBindings>
<asp:TreeNodeBinding DataMember="Node" TextField="xmlns" />
</DataBindings>
</asp:TreeView>
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 21 '06 #3
Hi Martin

I want to use the one for Windows (System.Windows.Forms).

Regards

PZ

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...

Preben Zacho wrote:
I want to load this XML file into a TreeView component


Which TreeView do you want to use, the one for Windows applications in
System.Windows.Forms or the one for ASP.NET 2.0 applications in
System.Web.UI.WebControls?

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Feb 22 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

42 posts views Thread by lauren quantrell | last post: by
5 posts views Thread by SoKool | last post: by
1 post views Thread by paradox | last post: by
6 posts views Thread by L.M | last post: by
14 posts views Thread by Mr.D | last post: by
3 posts views Thread by christof | last post: by
1 post views Thread by kvicky | last post: by
8 posts views Thread by Matt MacDonald | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.