Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using quotes in Xpath

Say if I need to use an XPath expression as follows

v:MapLink[@Entity='TOM'S RESTAURANT']

But an exception is thrown because of the quote in TOM'S.

Is there a way around this?

Thanks.

like image 276
daniely Avatar asked Jan 16 '23 21:01

daniely


2 Answers

presumably this is all inside a string itself, so would this work?

"v:MapLink[@Entity=\"TOM'S RESTAURANT\"]"
like image 122
mayhewr Avatar answered Jan 25 '23 22:01

mayhewr


Just use different quotes around the attribute:

v:MapLink[@Entity="TOM'S RESTAURANT"]
like image 33
BoltClock Avatar answered Jan 25 '23 22:01

BoltClock