Node order of XPath result
Sascha Ziemann <[email protected]> Fri, 5 Dec 2014 08:50:05 +0100
| Newsgroups | gmane.lisp.scheme.ssax-sxml |
|---|---|
| Message-ID | <CAGUt3y4OaEg2AT-z5FqAxgBouDyPZPVopGE3NsB-fyJLyn56jw@mail.gmail.com> |
Hi,
I am using the sxpath egg in Chicken-Scheme and I am getting a wrong result
for an XPath query. I asked this question already on the Chicken-Scheme
mailing list, but they told me, that I should try to discuss the problem
here.
This example
(use regex)
(use http-client)
(use sxpath)
(use html-parser)
((sxpath "//h1[@class='header']//*/text()")
(with-input-from-request
"http://www.imdb.com/title/tt0497465/"
#f html->sxml))
returns the following result:
("Vicky Cristina Barcelona" "(" ")" "2008")
But the result I would expect is
("Vicky Cristina Barcelona" "(" "2008" ")")
because Firebug returns this:
$x("//h1[@class='header']//*/text()")
[<TextNode textContent="Vicky Cristina Barcelona">,
<TextNode textContent="(">,
<TextNode textContent="2008">,
<TextNode textContent=")">]
This example
(begin
(newline)
(pp ((sxpath "//h1[@class='header']//*")
(with-input-from-request
"http://www.imdb.com/title/tt0497465/"
#f html->sxml))))
((span (@ (class "itemprop") (itemprop "name")) "Vicky Cristina Barcelona")
(span (@ (class "nobr"))
"("
(a (@ (href "/year/2008/?ref_=tt_ov_inf")) "2008")
")")
(a (@ (href "/year/2008/?ref_=tt_ov_inf")) "2008"))
shows that the inner 'a' node gets duplicated somehow.
This looks like a bug to me.
Regards,
Sascha
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk