XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 13th, 2004, 09:34 PM
kiwinetter kiwinetter is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: New Zealand
Posts: 13 kiwinetter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old February 14th, 2004, 12:27 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
... translate($translateMe, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') ...

Reply With Quote
  #3  
Old February 14th, 2004, 03:16 PM
kiwinetter kiwinetter is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: New Zealand
Posts: 13 kiwinetter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old February 14th, 2004, 03:19 PM
kiwinetter kiwinetter is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: New Zealand
Posts: 13 kiwinetter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Aaaaaarggggghh double post!

Quote:
Originally Posted by MattSidesinger
... translate($translateMe, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') ...


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

Reply With Quote
  #5  
Old February 14th, 2004, 04:06 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
Will this work?

Code:
"NewDataSet/DStblDown[FullName!text() = translate('"+selection+"', 'ABC', 'abc')]/FullName";

Reply With Quote
  #6  
Old February 14th, 2004, 05:02 PM
kiwinetter kiwinetter is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: New Zealand
Posts: 13 kiwinetter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Not quite!

Quote:
Originally Posted by MattSidesinger
Will this work?

Code:
"NewDataSet/DStblDown[FullName!text() = translate('"+selection+"', 'ABC', 'abc')]/FullName";



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

Reply With Quote
  #7  
Old February 14th, 2004, 07:21 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
Try dropping the !text()

What happens now?

Reply With Quote
  #8  
Old February 14th, 2004, 07:54 PM
kiwinetter kiwinetter is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: New Zealand
Posts: 13 kiwinetter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sussed it!

Quote:
Originally Posted by MattSidesinger
Try dropping the !text()

What happens now?


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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Tricky XPath search using translate()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway