Re: SQLXML XPath data with apostrophe

Tech-Archive recommends: Fix windows errors by optimizing your registry



Gil wrote:

Code is in C#.
Values without apostrophes return just fine.

For example, the xpath would be something like:
"Users[@UserName='o'brien']"

If that is a C# string literal then
"Users[@UserName = \"o'brien\"]"
should do. If you need both single and double quotes inside the XPath string literal then you need concat e.g.
"Users[@UserName = concat('He said: \"o', \"'brien\")]"


--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/
.



Relevant Pages

  • Re: Passing xpath to a template
    ... In the end I resorted to a complete custom Xsl file and abandoned the mapper ... when I run a value-of statement on the xpath parameter I ... turns out to be the double quotes. ...
    (microsoft.public.biztalk.general)
  • Help: DOMXPath->Query, quotes and apostrophes
    ... I have the need to run an XPath query ... on strings that may contain quotes, ... Fatal error: Call to a member function itemon a non-object ... illegal for XPath from what I've read. ...
    (php.general)
  • Passing xpath to a template
    ... I ran into a bit of a piccle with the mapper. ... when I run a value-of statement on the xpath parameter I ... out to be the double quotes. ...
    (microsoft.public.biztalk.general)
  • Re: Passing xpath to a template
    ... I doug down and realized that the problem is that the xpath expressin ... needs to get evaluated before it gets sent to the template. ... not the value of the evaluation! ... turns out to be the double quotes. ...
    (microsoft.public.biztalk.general)