Re: yet another feeb attempt to escape quotes in XPaths

Discussion in 'XML' started by Bjoern Hoehrmann, Apr 13, 2008.

  1. * Phlip wrote in comp.text.xml:
    >Try this failing test:
    >
    > assert_xml '<html>
    > <form class=\'for_"sale"\' />
    > </html>'
    >
    > assert_tag_id :form, :class => 'for_"sale"'
    >
    >assert_tag_id builds the XPath needed to find that for_"sale" sign. Here's
    >what it builds for libxml:
    >
    > descendant-or-self::form[ @class = "for_&quot;sale&quot;" ]
    >
    >Yet that doesn't hit the sample XML. No error message, but no hit either.


    The entity references would be expanded only inside an XML document like
    a XSLT document, XPath itself has no such mechanism. You would have to
    use ' for the outer quotes

    ...[ @class = 'for_"sale"' ]

    And if you have to nest the quotes, you have to use concat to build the
    string, or variabels if you can.
    --
    Björn Höhrmann · mailto: · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
     
    Bjoern Hoehrmann, Apr 13, 2008
    #1
    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. Ed
    Replies:
    9
    Views:
    397
  2. Peter Olcott
    Replies:
    245
    Views:
    3,688
    Will Twentyman
    Aug 21, 2004
  3. GMI
    Replies:
    3
    Views:
    508
    Tad McClellan
    Jun 19, 2005
  4. Massi
    Replies:
    1
    Views:
    216
    Steven D'Aprano
    May 15, 2012
  5. Grant Edwards

    Yet another attempt at a safe eval() call

    Grant Edwards, Jan 3, 2013, in forum: Python
    Replies:
    26
    Views:
    349
    Ken Seehart
    Mar 15, 2013
Loading...

Share This Page