<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Query secondary xml datasource</title><link>https://www.infopathdev.com:443/forums/thread/9246.aspx</link><pubDate>Tue, 07 Mar 2006 17:48:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:9246</guid><dc:creator>sjc724</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/9246.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=9246</wfw:commentRss><description>Found the answer, and it is very basic (I lost sight of the fact that the whole 'selectNodes' is taking a string):&lt;br /&gt;&lt;br /&gt;Instead of:&lt;br /&gt;&lt;br /&gt;contactNodes = thisXDocument.GetDOM("Contacts").selectNodes("ContactData/Contact[contains(last_name, searchString)]");&lt;br /&gt;&lt;br /&gt;I needed to do the following:&lt;br /&gt;&lt;br /&gt;contactNodes = thisXDocument.GetDOM("Contacts").selectNodes("ContactData/Contact[contains(last_name,'" + searchString + "')]");&lt;br /&gt;</description></item><item><title>Re: Query secondary xml datasource</title><link>https://www.infopathdev.com:443/forums/thread/9245.aspx</link><pubDate>Tue, 07 Mar 2006 12:01:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:9245</guid><dc:creator>sjc724</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/9245.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=9245</wfw:commentRss><description>Here is a bit more detail:&lt;br /&gt;&lt;br /&gt;I get the text that the user typed and put it in a string variable:&lt;br /&gt;&lt;br /&gt;string searchString = thisXDocument.DOM.selectSingleNode("//SIUData/ReportContacts/last_name").text;&lt;br /&gt;&lt;br /&gt;Then I pass the string variable to an xpath function to find all nodes containing that string:&lt;br /&gt;&lt;br /&gt;contactNodes = thisXDocument.GetDOM("Contacts").selectNodes("ContactData/Contact[contains(last_name, searchString)]");&lt;br /&gt;&lt;br /&gt;And then I get the node count:&lt;br /&gt;nodeCount = contactNodes.length; &lt;br /&gt;&lt;br /&gt;If I substitute a literal string for the searchString variable, everything works fine.  Is there any way I can use a string variable to search an xml document using xpath an query??&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Query secondary xml datasource</title><link>https://www.infopathdev.com:443/forums/thread/5424.aspx</link><pubDate>Mon, 06 Mar 2006 17:13:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:5424</guid><dc:creator>sjc724</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/5424.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=5424</wfw:commentRss><description>Hi,  I'm new to xpath and having a problem creating the query I need.  &lt;br /&gt;&lt;br /&gt;I have an xml document as a secondary datasource.  I would like to use a text string that the user types in a text box to search for all matching nodes in the xml datasource.  I have tried the 'contains' and 'starts-with' xpath functions but neither one seems to work if you pass the search string argument as a string variable.&lt;br /&gt;&lt;br /&gt;Is there a better way to achieve the same results?  Is there another xpath function I should be using?&lt;br /&gt;&lt;br /&gt;Thanks.</description></item></channel></rss>