• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 369
  • Last Modified:

XPath Syntax

I am getting and invalid token exception.

XML Doc

root>
  <client name="Life Vista" id="2342342">


Code
XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(@"C:\mix.xml");

            //Get Client Node by ClientID
           
   XmlNode clientNode = xmlDoc.SelectSingleNode("/root/client[attribute::type='id'][contains(text( ),'"+ClientID.ToString()+"']");

Ex.Message
{"'/root/client[attribute::type='id'][contains(text( ),'2342342'' has an invalid token."}
0
onholdmarketing
Asked:
onholdmarketing
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
XmlNode clientNode = xmlDoc.SelectSingleNode("/root/client[@type='id'][contains(text( ),'"+ClientID.ToString()+"']");
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now