473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Putting an XML document in a TreeView.

I would like to put an XML document into a Windows TreeView. I have started
with XmlTextReader and seem to get stuck with all of the different Read/Move
commands available. I was wondering if someone else has already gone through
the pain of descending through an XML document either printing or adding the
attribute and element values and names to a TreeView? It would just save me
some time as I will have to do some trial and error to get it to work.

Thank you.

Kevin
Nov 12 '05 #1
5 3174
Hello!

Maybe you could use XmlDocument, it should be easy to convert from one
tree-like structure to another.
(You're wasting memory with the TreeView-Tree, why not waste a little
more? :D)
--
Pascal Schmitt
Nov 12 '05 #2
I am using XmlDocument and an XmlNodeReader created from the XmlDocument but
I am getting a little overwhelmed with the NodeType, Value, HasValue,
HasAttribute, MoveToElement, MoveToFirstAttribute, Read, etc. I am not sure
how to use the reader to read all of the attributes and all of the elements.
I was hoping someone had tackled this before.

Thank you.

Kevin

"Pascal Schmitt" wrote:
Hello!

Maybe you could use XmlDocument, it should be easy to convert from one
tree-like structure to another.
(You're wasting memory with the TreeView-Tree, why not waste a little
more? :D)
--
Pascal Schmitt

Nov 12 '05 #3
Hallo, Kevin,

Kevin Burton:
I would like to put an XML document into a Windows TreeView.


http://support.microsoft.com/default...b;en-us;308063
http://support.microsoft.com/default...b;en-us;317597

Mark
Nov 12 '05 #4

Thank you this answered my question. How would the code be modified to
include attributes?

Kevin

"Mark Doerbandt" wrote:
Hallo, Kevin,

Kevin Burton:
I would like to put an XML document into a Windows TreeView.


http://support.microsoft.com/default...b;en-us;308063
http://support.microsoft.com/default...b;en-us;317597

Mark

Nov 12 '05 #5
Hallo, Kevin,

Kevin Burton:
How would the code be modified to include attributes?


e.g.

foreach (XmlAttribute xAtt in inXmlNode.Attributes) {
if (xAtt.Name=="Name") {
tNode.Text += ": " + xAtt.Value;
} else {
TreeNode aNode = new TreeNode(xAtt.Name);
inTreeNode.Nodes.Add(aNode);
aNode.Tag = xAtt.Value;
}
}

Mark
Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Zhang Weiwu | last post by:
Hello. I just read a article "rdf in html: approaches" at "http://infomesh.net/2002/rdfinhtml" (guided by google). Looking into the "Embed XML RDF Part II: Embrace Validation" part, there are an...
42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
3
by: Franck | last post by:
Hi, got a problem with my javascript and I think it's more linked to my asp.net code than script. (the reason I post here) In an ascx control, I've got two controls, one textbox and one Telerik...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
1
by: kvicky | last post by:
I am trying to load child nodes to a TreeNode in a TreeView in a ASP.net web application. The Treeview with parent nodes are loaded on a Page_load while doing if( ! ISPostback ) and then in the...
2
by: MrNobody | last post by:
I am trying to extend TreeView to add some of my own functionality and I needed to put a public method but the compiler won't let me and I really don't understand why. I declared my class: ...
0
by: Rama Jayapal | last post by:
I am pretty new to VB, so please forgive the simplistic question. This is using VB .NET 2005 My form has three objects on it: a TextBox named URL, a Button named Extract and a WebBrowser named...
1
by: pnalla | last post by:
Hi, I have designed a windows for using C#. It contais lefthand side treeview. when i am click on the treeview documts it will be displayed on the right hand sideon windows form. For Example ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.