View Single Post
  #1 (permalink)  
Old November 28th, 2007, 10:34 AM
Hughesie78 Hughesie78 is offline
Authorized User
 
Join Date: Nov 2007
Location: , , Ireland.
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hughesie78
Default XPath Invalid token

I Have an issue with XPATH and im looking for some help
Here is my code behind on my aspx page
XmlNodeList codelist = bankdoc.SelectNodes("//bank[text() = '" + GetXPathString(strBank) + "'] and ..branch[text()= '" + GetXPathString(strBranch) + "'] ");

GetXPathString is a fxn to concat the 2 string, here it is

           public static string GetXPathString(string input)
           {
               string [] fragments = input.Split(new char[] {'\''});
               string result = "";
               result += "concat(''";
               for (int i = 0; i < fragments.Length; i++)
               {
                   result += ", '" + fragments[i] + "'";
                   if (i < fragments.Length - 1)
                   {
                       result += ", \"'\"";
                   }
               }
               result += ")";
              return result;


           }

However when I run I get the error;
'//bank[text() = 'concat('', 'XXX rrrreee')'] and ..branch[text()= 'concat('', 'xxx wwwwol')'] ' has an invalid token.
Exception Details: System.Xml.XPath.XPathException: '//bank[text() = 'concat('', 'XXX rrrreee')'] and ..branch[text()= 'concat('', 'XXX rrrreee')'] ' has an invalid token.

any ideas?
__________________
Thank You
Reply With Quote