Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > how to xpath if query string has embedded quotes

Reply
Thread Tools

how to xpath if query string has embedded quotes

 
 
dima
Guest
Posts: n/a
 
      12-09-2003
I'm using msxml3

xml looks like this: <a desc="&quot;B&quot;" />

how to query it in xpath? here's what i tried:
a[@desc="\"B\""] -- This works under XSL Patterns, but not under Xpath
(using msxml 3)

a[@desc=' "B" '] --this will work, but what if description has single
quotes too? -then it won't work.

in short, i'm stuck. can anybody help?

thanks.
dmitry.
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-09-2003


dima wrote:

> I'm using msxml3
>
> xml looks like this: <a desc="&quot;B&quot;" />
>
> how to query it in xpath? here's what i tried:
> a[@desc="\"B\""] -- This works under XSL Patterns, but not under Xpath
> (using msxml 3)
>
> a[@desc=' "B" '] --this will work, but what if description has single
> quotes too? -then it won't work.


Use it as long as you don't have quotes of the same type nested.
Otherwise with XPath 1.0 all you can do is to use the concat function
the whole string from pieces with the quotes you need.
I don't know whether XPath 2.0 makes that any easier.

--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double quotes embedded in a string ... Dale Martenson Ruby 1 07-28-2006 04:08 PM
Asp.NET Javascript string, want to pass '(single quotes' within '(single quotes) Chris ASP .Net 1 03-24-2006 09:03 PM
Escaping single quotes in XPath query with REXML Francis Hwang Ruby 2 10-21-2004 08:36 AM
Quotes/Double Quotes in Image Control Chris White ASP .Net 1 09-22-2004 06:22 AM
Multiline quotes - escaping quotes - et al Lawrence Tierney Java 3 12-24-2003 05:12 PM



Advertisments