Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML 'Like' Search

Status
Not open for further replies.

Elroacho

Programmer
Apr 19, 2004
59
NZ
Hi,

I'm working on an application that searches through an XML document to find data. All works well for exact string but I now need to expand it to include a 'like' search (e.g. pick out a node using a search sting 'TEST' and finding a node containing 'MY TEST SEARCH' as text.

Any Ideas?

Cheers in advance.
 
What are you coding in?

Regular Expressions sound like the way to go if your development environment supports them.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Hi, I'm coding in C#.

My line looks like this at the moment.....

Code:
string xpath = string.Format("//vw:OUTLET[vw:OUTLET_NUMBER=\"{0}\"]", routename);

I want to do something like this but on a string using a "like" type search. Is it possible.

Cheers.
 
i would use xpath function "contains()" and also convert to lower case as the search will be case sensitive.

Code:
<xsl:value-of select="contains(translate(//root/etc/@bob,'abcdefghijklmnopqrstuvxyz','ABCDEFGHIJKLMNO­PQRSTUVXYZ'), 'string')"/>

untested - just to give you an idea

hth

simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top