473,396 Members | 2,038 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,396 software developers and data experts.

tree node from xml

Hello,
I have such declaration in function:
tmptreenode = new TreeNode(node.Name);
but I need an attribute name and not Name ,I tried to do something like
that:
tmptreenode = new TreeNode(node.Attributes);
but it doesn't work,how can I solve this?
Thank you v. much!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
5 3755
node.Attributes["name"]

Gabriel Lozano-Morán

"juli jul" <ju******@yahoo.com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
Hello,
I have such declaration in function:
tmptreenode = new TreeNode(node.Name);
but I need an attribute name and not Name ,I tried to do something like
that:
tmptreenode = new TreeNode(node.Attributes);
but it doesn't work,how can I solve this?
Thank you v. much!

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #2
Thanks but it's not working this way:
tmptreenode = new TreeNode(node.Attributes["name"]);

it throws a compile error:
error CS1503: Argument '1': cannot convert from
'System.Xml.XmlAttribute' to 'System.Windows.Forms.TreeView'

How to solve this? Thank you!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3
That's because an XmlNode is not the same as a TreeNode. Fill up the
treeview with the InnerText value of the XmlNode.

Example:

XmlDocument doc = new XmlDocument();
XmlNode myNode;
doc.Load(@"c:\document.xml");
myNode = doc.SelectSingleNode(<XPath query>);
treeView1.Nodes.Add(myNode.InnerText);

Gabriel Lozano-Morán

"juli jul" <ju******@yahoo.com> wrote in message
news:O0**************@TK2MSFTNGP14.phx.gbl...
Thanks but it's not working this way:
tmptreenode = new TreeNode(node.Attributes["name"]);

it throws a compile error:
error CS1503: Argument '1': cannot convert from
'System.Xml.XmlAttribute' to 'System.Windows.Forms.TreeView'

How to solve this? Thank you!

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #4
Could you pleas tell me which xpath query I should use ?
I am new on this xml subject.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #5
You don't need a XPath query I use it to search nodes within an XML
document. You can use the XmlNodeReader class if you wish:

http://msdn.microsoft.com/library/de...nodereader.asp

Gabriel Lozano-Morán

"juli jul" <ju******@yahoo.com> wrote in message
news:O4****************@TK2MSFTNGP15.phx.gbl...
Could you pleas tell me which xpath query I should use ?
I am new on this xml subject.
Thanks

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #6

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

Similar topics

3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
0
by: t_pet422 | last post by:
Hi, I've been scouring the net and reading the PostgreSQL docs for a while now trying to learn how to create a recursive function in PL/pgSQL that will return a whole subtree given a starting...
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
6
by: sathyashrayan | last post by:
#include<stdio.h> #include<stdlib.h> #include<string.h> struct tree { int data; struct tree *left,*right; }; void init(struct tree *node)
22
by: delraydog | last post by:
It's quite simple to walk to the DOM tree going forward however I can't figure out a nice clean way to walk the DOM tree in reverse. Checking previousSibling is not sufficient as the...
2
by: andrew browning | last post by:
gbd says the segmentation fault is being generated in the insert function. //CONSTRUCTOR tree():data(value_type()), left(0), right(0){}; tree(value_type vt, tree* l = 0, tree* r = 0):...
1
by: Amit Bhatia | last post by:
User-Agent: OSXnews 2.081 Xref: number1.nntp.dca.giganews.com comp.lang.c++:817435 Hi, I searched online to see if this is valid or not (since my classes are still very incomplete, I am...
4
by: whitehatmiracle | last post by:
Hello I have written a program for a binary tree. On compiling one has to first chose option 1 and then delete or search. Im having some trouble with the balancing function. It seems to be going...
2
by: Defected | last post by:
Hi, How i can implement a main function with this Binary Search Tree. thanks for help. is this code corrected ? #include<iostream>
2
by: uche | last post by:
Guys, I am trying to build a Parse Tree with the following grammar. I have implemented my insertions using a standard binary tree inserting algorithm. With the psuedocode below, can you guys...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.