On Thu, Oct 21, 2004 at 09:28:51AM +0100, Brian Candler wrote:
> Try passing your string through this before constructing your XPath query:
> 
>   require 'rexml/text'
>   a = "John's Doe"
>   b = REXML::Text::normalize(a)
>   #=> "John's Doe"

Hmm, that doesn't work.

irb(main):007:0> XPath.first( xmldoc, "/rss/channel/item/title[text()='John's Doe']" ).to_s
=> ""
irb(main):008:0> XPath.first( xmldoc, "/rss/channel/item/title[text()='John's Doe']" ).to_s
=> ""
irb(main):009:0> XPath.first( xmldoc, "/rss/channel/item/title[text()=\"John's Doe\"]" ).to_s
=> "<title>John's Doe</title>"

You might want to raise that with the REXML author. In the mean time, if you
know the string only contains single quotes, then you can surround it with
double quotes in the XPath query, as per the third line above.

Regards,

Brian.