By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,957 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,957 IT Pros & Developers. It's quick & easy.

generalzing the xpathexpression using variables <<urgent>>

P: 7
hi to all,

i am new to this forum and also new to xml too...

i have an xpath expression to select a list of values...

XmlNodeList nl=doc.SelectNodes("//group[@group_name='Friends']/@group_name")

it can select only the node having value as Friends

i want to generalize the expression by substituting a variable in place of 'Friends'

how can i do .....
pls guide me
Feb 21 '08 #1
Share this Question
Share on Google+
1 Reply


100+
P: 141
Hi ,

this how u can use variables in xpath expressions
string varGroup="Friends"
xmlDoc.SelectSingleNode("//group[@group_name = '" + varGroup + "']").InnerText


hi to all,

i am new to this forum and also new to xml too...

i have an xpath expression to select a list of values...

XmlNodeList nl=doc.SelectNodes("//group[@group_name='Friends']/@group_name")

it can select only the node having value as Friends

i want to generalize the expression by substituting a variable in place of 'Friends'

how can i do .....
pls guide me
Feb 21 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.