XPath Syntax

Posted on 2006-05-12
Last Modified: 2008-01-09
I am getting and invalid token exception.


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

XmlDocument xmlDoc = new XmlDocument();

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

{"'/root/client[attribute::type='id'][contains(text( ),'2342342'' has an invalid token."}
Question by:onholdmarketing
    1 Comment
    LVL 52

    Accepted Solution

    XmlNode clientNode = xmlDoc.SelectSingleNode("/root/client[@type='id'][contains(text( ),'"+ClientID.ToString()+"']");

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now