[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] sxpath does not preserve node order
From: |
Jörg F. Wittenberger |
Subject: |
Re: [Chicken-users] sxpath does not preserve node order |
Date: |
Fri, 05 Dec 2014 11:55:39 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux armv7l; rv:31.0) Gecko/20100101 Icedove/31.2.0 |
Am 04.12.2014 um 21:25 schrieb Sascha Ziemann:
> It seems to me that the use of //* duplicates the inner 'a' node:
That's not what it does. I'm not completely sure that XPath does
require this behavior, but I tend to believe this is the right thing to
do. "//" is supposed to yield all descendant nodes, in this example the
second "span" (sure including this "span"'s descendant "a") and the "a"
node itself.
However the out-of-order result of "text()" nodes is odd. I guess that
one is wrong.
>
> (begin
> (newline)
> (pp ((sxpath "//address@hidden'header']//*")
> (with-input-from-request
> "http://www.imdb.com/title/tt0497465/"
> #f html->sxml))))
>
> prints
>
> ((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"))
>
> Although there is only one hyper-ref in the HTML code.
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>