|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Tricky XPath search using translate()
Thanks in advance.
I have a rather large MSXML Dom object with this structure: <DStblDown> <FullName>Leroy Brown</FullName> <Address>121 Mean st</Address> <City>Vegas</City> <Country>USA</Country> <Email>bbbb@bbb</Email> <Phone>212545</Phone> <Comments>Bad</Comments> </DStblDown> under a root node of <NewDataSet> I am storing a set of customers which needs to be searched on the client side. If I retrieve a variable 'selection' from the user I can perform a case sensitive 'Full Name' search using: "NewDataSet/DStblDown[FullName!text() ='"+selection+"']/FullName"; However, the problem is I want (have) to perform a non-case sensitive search for 'Full Name'. I know this is possible using the translate() method but it has got me stumped! Can anyone help at all? Cheers |
|
#2
|
||||
|
||||
|
... translate($translateMe, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') ...
|
|
#3
|
|||
|
|||
|
Where in path?
Thanks for that Matt.
One remaining problem (I'm having a duh moment) I cannot place the translate() method into : NewDataSet/DStblDown[FullName!text() ='"+selection+"']/FullName and get the damn thing to work! Where would the translate you suggested fit in and still parse OK? Cheers - Mike |
|
#4
|
|||
|
|||
|
Aaaaaarggggghh double post!
Quote:
Sorry Matt - methinks I have posted this twice! One remaining problem (I'm having a duh moment) I cannot place the translate() method into : NewDataSet/DStblDown[FullName!text() ='"+selection+"']/FullName and get the damn thing to work! Where would the translate you suggested fit in and still parse OK? Cheers - Mike |
|
#5
|
||||
|
||||
|
Will this work?
Code:
"NewDataSet/DStblDown[FullName!text() = translate('"+selection+"', 'ABC', 'abc')]/FullName";
|
|
#6
|
|||
|
|||
|
Not quite!
Quote:
HI there ran the code but got this error (same error as I have been getting repeatedly in past attempts): msxml3.dll: Unknown method. NewDataSet/DStblDown[FullName!text() = -->translate('Leroy Brown'<--, 'ABC', 'abc')]/FullName Cheers - Mike |
|
#7
|
||||
|
||||
|
Try dropping the !text()
What happens now? |
|
#8
|
|||
|
|||
|
Sussed it!
Quote:
Hi Matt Finally got it sussed. Thanks for your help - set me on the correct path (sorry about the pun) I had to use: domObject.setProperty("SelectionLanguage", "XPath"); MSXML would not accept the translate() method without this - who knows! The workin path is now: "NewDataSet/DStblDown/FullName[translate(text(), 'abc...', 'ABC..;')='"+selection.toUpperCase()+"']"; Thanks again Cheers - Mike |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Tricky XPath search using translate() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|