Ticket #303 (new defect)

Opened 14 years ago

xpath-parser.ss problem w/ abbreviated xpath syntax

Reported by: dmarshall207@… Owned by: lizorkin
Priority: minor Milestone:
Component: lizorkin/sxml.plt Keywords:
Cc: Version: (2 1)
Racket Version: 4.2.1.1

Description

Hi, I'm somewhat new and did not notice the ticket
feature so I sent this report in yesterday to email
addresses listed in the source code.

I thought I'd resend it here again as it's probably
better protocol:

subject : bug in xpath-parser.ss

First, thank you for all the OS PLT-Scheme -- errr
I mean, Racket code. I love this stuff.

There seams to be a problem with some special cases for
abbreviated xpath syntax -- looks like absolute paths
have problems with xpaths that start with one of :
"div", "mod", "and", "or".
(could be that I just don't understand the specs)

examples to illustrate :

;;----------------------------------------------------
;; Works :
(let*([data '(*TOP*

(*PI* xml "version='1.0'")
(one "111"

(two "222")))])

(list

(eval-xpath "/one" data)
(eval-xpath "/one/two" data)))

;;----------------------------------------------------
;; Fails :
(let*([data '(*TOP*

(*PI* xml "version='1.0'")
(div "111"

(two "222")))])

(eval-xpath "/div" data))

;; Error Message :
;; XPath/XPointer parser error: unexpected end of XPath
;; expression. Expected - NCName procedure application: expected
;; procedure, given: #f; arguments were: (*TOP* (*PI*
;; xml "version='1.0'") (div "111" (two "222")))

;;----------------------------------------------------
;; Fails :
(let*([data '(*TOP*

(*PI* xml "version='1.0'")
(div "111"

(two "222")))])

(eval-xpath "/div/two" data))

;; Error Message :
;; /: division by zero

;;------------------------------------------------------------------
;; Works :
(let*([data '(*TOP*

(*PI* xml "version='1.0'")
(div "111"

(two "222")))])

(list

(eval-xpath "div/two" data)
(eval-xpath "/child::div" data)
(eval-xpath "/child::div/two" data)))

Davis Marshall

Note: See TracTickets for help on using tickets.