xpath contains() function - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » xpath contains() function xpath contains() function Last post 06-02-2010 10:49 AM by Jimmy. 3 replies. Page 1 of 1 (4 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 06-02-2010 08:34 AM arcad Joined on 05-10-2010 Posts 15 xpath contains() function Reply Contact Hello, I am trying to use the contains() function as a wildcard search. My second attribute is a string. I am getting "an xpathexception was unhandled by code". Do you have any ideas of how I could fix that? Thanks a lot! string Ep = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group1/my:Person/my:DisplayName", NamespaceManager).Value; XPathNodeIterator rows = secDSNav.Select("/dfs:myFields/dfs:dataFields/dfs:Assets[contains(@EpData,'" + Ep + "')]", NamespaceManager); 06-02-2010 08:48 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: xpath contains() function Mark as Not AnswerMark as Answer... Reply Contact Do you know what the value of Ep is in this code? Might it contain any apostrophies? Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 06-02-2010 10:22 AM In reply to arcad Joined on 05-10-2010 Posts 15 Re: xpath contains() function Mark as Not AnswerMark as Answer... Reply Contact Yes some values contained some apostrophes. Thanks! 06-02-2010 10:49 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: xpath contains() function Mark as Not AnswerMark as Answer... Reply Contact Does it work if you use: XPathNodeIterator rows = secDSNav.Select("/dfs:myFields/dfs:dataFields/dfs:Assets[contains(@EpData,'" + Ep.Replace("'", "'") + "')]", NamespaceManager); Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software Page 1 of 1 (4 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Hello,
I am trying to use the contains() function as a wildcard search. My second attribute is a string. I am getting "an xpathexception was unhandled by code". Do you have any ideas of how I could fix that?
Thanks a lot!
Do you know what the value of Ep is in this code? Might it contain any apostrophies?
Yes some values contained some apostrophes. Thanks!
Does it work if you use:
XPathNodeIterator rows = secDSNav.Select("/dfs:myFields/dfs:dataFields/dfs:Assets[contains(@EpData,'" + Ep.Replace("'", "'") + "')]", NamespaceManager);