TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
night sailor
NA
20
39.4k
Strange Problem
Jan 13 2011 6:48 AM
Hi...
I am using this xml:
<xml>
<employee>
<person>
<name>
a
</name>
<lucky>80</lucky>
<send>
<name1>
b
</name1>
</send>
</person>
<person>
<name>
c
</name>
<lucky>160</lucky>
<send>
<name1>
d
</name1>
</send>
</person>
</employee>
</xml>
And this is some part part of my code :
XmlNodeList nameList = xmldoc.SelectNodes("//employee/person");
foreach (XmlNode nameNode in nameList)
{
if (nameNode.SelectSingleNode("name").InnerText == "c")
{
string bug1 = nameNode.SelectSingleNode("//send/name1").InnerText;
string bug2 = nameNode.SelectSingleNode("lucky").InnerText;
}
}
On executing this code, i should expect
bug1 = d
bug2 = 160
but i am getting
bug1 = b
bug2 = 160
Please help...Tell me if i am wrong in selecting node (//send/name1)....
Thanks
Reply
Answers (
3
)
Save and load Treeview nodes in serialized order to /from XML file
PGP in Windows 7