<div dir="ltr"><div><div>Hi Racket Users,<br><br></div>I'm using se-path*/list to extract values from an XML collection but I found a strange behaviour when the extracted values contain entities.<br><br></div>For example, given the following XML:<br>
<div><br><bands><br> <name>Derek & the
Dominos</name><br> <name>Nick Cave & the Bad
Seeds</name><br></bands><br><br></div><div>when I extract a list of band names with (se-path*/list '(name) xe) I'd expect this result:<br><br> '("Derek & the Dominos" "Nick Cave & the Bad Seeds")<br>
<br>but what I actually receive is:<br><br> '("Derek " "&" " the Dominos" "Nick Cave " "&" " the Bad Seeds")</div><div><br>Is this the intended behaviour? How can I overcome this and make se-path*/list return one string for tag?<br>
<br></div><div>Here's my test code, I'm running Racket v5.3.6 on Linux x86_64 and maybe I'm doing overlooking something because I'm new to Racket.<br></div><div><br></div><div>Thank you in advance!<br></div>
<div><br></div><div>Best regards,<br>Giacomo<br></div><div><div><div><br>#lang racket<br><br>(require xml<br> xml/path)<br><br>(define xe (string->xexpr "<bands><name>Derek & the Dominos</name><name>Nick Cave & the Bad Seeds</name></bands>"))<br>
<br>(module+ test<br> (require rackunit)<br><br> ;; what I get<br> (check-equal? (se-path*/list '(name) xe)<br> '("Derek " "&" " the Dominos" "Nick Cave " "&" " the Bad Seeds"))<br>
<br> ;; what I'd expect<br> (check-equal? (se-path*/list '(name) xe)<br> '("Derek & the Dominos" "Nick Cave & the Bad Seeds")))<br></div></div></div></div>