how to xpath if query string has embedded quotes

Discussion in 'XML' started by dima, Dec 9, 2003.

  1. dima

    dima Guest

    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.
    dima, Dec 9, 2003
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Dec 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris White

    Quotes/Double Quotes in Image Control

    Chris White, Sep 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,835
    Hermit Dave
    Sep 22, 2004
  2. Chris
    Replies:
    1
    Views:
    13,609
    Oisin
    Mar 24, 2006
  3. Lawrence Tierney

    Multiline quotes - escaping quotes - et al

    Lawrence Tierney, Dec 24, 2003, in forum: Java
    Replies:
    3
    Views:
    4,483
    Andrew Thompson
    Dec 24, 2003
  4. Francis Hwang
    Replies:
    2
    Views:
    329
    Brian Candler
    Oct 21, 2004
  5. Dale Martenson

    Double quotes embedded in a string ...

    Dale Martenson, Jul 28, 2006, in forum: Ruby
    Replies:
    1
    Views:
    300
Loading...

Share This Page