473,395 Members | 1,756 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.

attributes(xml)

Hello ,
Here is the code of the function I want to use:

private TreeNode CreateTreeNodeFromXmlNode(XmlNode node)
{
TreeNode tmptreenode = new TreeNode();

if((node.HasChildNodes) && (node.FirstChild.Value != null))
{
tmptreenode = new TreeNode(node.Name);
TreeNode tmptreenode2 = new TreeNode(node.FirstChild.Value);
tmptreenode.Nodes.Add(tmptreenode2);
}
else if(node.NodeType != XmlNodeType.CDATA)
{
tmptreenode = new TreeNode(node.Name);

}

return tmptreenode;
}
The problem is that insted of node.Name I want node.Attributes["name"]
to be presented and not really understan how can I do it.
Can someone help me?
Thank you

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
1 1365
i am not quite sure if this is what you want but i would replace

tmptreenode = new TreeNode(node.Name);

with

tmptreenode = new TreeNode(node.Attributes["name
].Value);

Stephan

juli jul wrote:
Hello ,
Here is the code of the function I want to use:

private TreeNode CreateTreeNodeFromXmlNode(XmlNode node)
{
TreeNode tmptreenode = new TreeNode();

if((node.HasChildNodes) && (node.FirstChild.Value != null))
{
tmptreenode = new TreeNode(node.Name);
TreeNode tmptreenode2 = new TreeNode(node.FirstChild.Value);
tmptreenode.Nodes.Add(tmptreenode2);
}
else if(node.NodeType != XmlNodeType.CDATA)
{
tmptreenode = new TreeNode(node.Name);

}

return tmptreenode;
}
The problem is that insted of node.Name I want node.Attributes["name"]
to be presented and not really understan how can I do it.
Can someone help me?
Thank you

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

Nov 17 '05 #2

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

Similar topics

7
by: Info 3000 | last post by:
Hello, I'm beginner in XML. I have just a little question : I understand that I can write : <Book> <Title> A nice day </Title> <Author> James Nicepen </Author> </Book>
2
by: monsterpot | last post by:
Hello, I have a document like this: <parameters> <param ptype="init">somedata</param> <param ptype="process">moredata</param> <param ptype="kill">alsodata</param> </parameters> <param> has...
2
by: Vitali Gontsharuk | last post by:
Hi! I can't find an answer to the following question: does the "import" command in XML Schema import also element declarations? Or only type definitions? As far as I understood, the first takes...
2
by: Mike LeBlanc | last post by:
Hi, I have a desired xml output that looks like this <?xml version="1.0" encoding="UTF-8"?><onhand_request><item organization_id="414">1</item><item...
6
by: LesleyW | last post by:
Hi Apologies if this is a really dumb question, but being new to XML and Schemas, I wonder if giving the namespace for eg xsd or xsi as a website address means that the user has to be online...
1
by: Steven Quail | last post by:
Hi to all, I have just started looking at XML.Serialization classes and would like to know how I set an attribute for an XML element. For example, I want my XML doc to look like the following:...
0
by: Hari Sekhon | last post by:
I've written an xml parser using xml.sax which works most of the time but often traces back when trying to read a file. The output of the traceback is below: Traceback (most recent call last):...
0
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store ...
1
by: Max | last post by:
Hello everyone! I would want to know if reserved attributes (xml:lang, xml:space, xmlns:prefix etc.) are parsed and registered as normal attributes. As an example: xmlns:cc="http://namespace"...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.