Groups | Blog | Home
all groups > dotnet xml > april 2005 >

dotnet xml : present attributes instead of a name


juli jul
4/4/2005 5:34:16 AM

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.(It is not
going through compilation if I use the node.Attributes["name"])
Can someone help me?
Thank you


Robbe Morris [C# MVP]
4/4/2005 9:15:10 PM
node.Attributes["name"].Value


--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx



[quoted text, click to view]

AddThis Social Bookmark Button