using variables in xpath expresion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajasekharsiva
    New Member
    • Jan 2008
    • 7

    using variables in xpath expresion

    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.SelectNo des("//group[@group_name='Fr iends']/@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
  • vee10
    New Member
    • Oct 2006
    • 141

    #2
    Hi ,

    this is how u can use a variable in the xpath expressions
    string variableGroup=" Friends"
    xmlDoc.SelectSi ngleNode("//group[@group_name = '" + variableGroup + "']").InnerTex t



    Originally posted by rajasekharsiva
    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.SelectNo des("//group[@group_name='Fr iends']/@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

    Comment

    Working...