i'm working with IE and the "selectNodes" and "selectSingleNode" methods to retrieve node results from an xml file. i know how to use some basic xPath commands to query the xml document to get what i want. however, one thing i can't figure out is how to select a node based on whether its text is equal to or contains a given string.
for example, i have an xml document with a node called "description". i want to have a search utility where the user can type in some text and click search and it will return all nodes that contain a "description" node that contains the search string. i tried using the xPath function "contains", but couldn't get that to work. any thoughts?
as an example, my xml document might look like...
my javascript code might look like...
i found one example that showed a general syntax of...
...but it doesn't recognize "contains" to be a valid method.
thanks,
glenn
for example, i have an xml document with a node called "description". i want to have a search utility where the user can type in some text and click search and it will return all nodes that contain a "description" node that contains the search string. i tried using the xPath function "contains", but couldn't get that to work. any thoughts?
as an example, my xml document might look like...
Code:
<item id="1">
<description>description of item one</descriptioin>
</item>
<item id="2">
<description>description of item two</description>
</item>
Code:
var nodeSet = xmlItems.XMLDocument.selectNodes(criteria)
Code:
...selectNodes("//description [contains(text(),searchString)]");
thanks,
glenn