Menu

#7 Bug in TXpXPathParser.Tokenize

open
nobody
None
5
2013-01-15
2004-08-10
Tor Helland
No

This xpath does not work when passed to selectNode:
'/dataSetLibrary/dataSet
[@name="FullTest"]/defineSelect/where/or/whereField'

Tokenize mistakes the "or" element in the path for a
boolean operator.

This works, but doesn't give the same level of control:
'/dataSetLibrary/dataSet
[@name="FullTest"]/defineSelect/where/*/whereField'

I don't really know, but I didn't think xpath excluded
those operators from use as element names.

-tor

Discussion

  • Tor Helland

    Tor Helland - 2004-08-11

    Logged In: YES
    user_id=685196

    This path represents a workaround, and worked in my test:
    '/dataSetLibrary/dataSet
    [@name="FullTest"]/defineSelect/where/child::*[name()
    ="or"]/whereField'

    But there may be other problems, because this did not work
    (removing the dataSet name test, got no node):
    '/dataSetLibrary/dataSet/defineSelect/where/child::*[name()
    ="or"]/whereField'
    I think I should have gotten at least 1 node, though maybe in
    the wrong dataSet. (Or my xpath skills may be too weak.)

    -tor

     
  • Tor Helland

    Tor Helland - 2004-08-27

    Logged In: YES
    user_id=685196

    I enclose a proposed fix (both a diff file and a corrected
    XpDom.pas). What I have done is identified some preceding
    token types that should prevent and, or, mod, div, and quo
    from being interpreted as operators - thereby causing them
    to be elements.

    The list of token types is probably not correct (types missing,
    types that should not be there).

    -tor

     
  • Tor Helland

    Tor Helland - 2004-08-27

    diff of my fix in XpDom.pas vs. 2.60 beta1

     
  • Tor Helland

    Tor Helland - 2004-08-27

    XpDom.pas with proposed fix

     

Log in to post a comment.

MongoDB Logo MongoDB