I found what looks like an XPath evaluation bug in the xmllint implementation from xmloxide.
This works correctly with libxml2's xmllint:
curl -sL https://news.ycombinator.com | xmllint --html --xpath "string((//span[@class='titleline']/a)[1]/@href)" -
Output:
But the xmloxide implementation returns the anchor text instead:
curl -sL https://news.ycombinator.com | xmllint-rs --html --xpath "string((//span[@class='titleline']/a)[1]/@href)" -
Output:
Ratty – A terminal emulator with inline 3D graphics
(xmllint-rs above is just the local alias I use for the xmloxide version to avoid confusion with libxml2's xmllint.)
Expected behavior is for the XPath expression to evaluate to the attribute value (href), not the text content of the <a> element.
Looks like attribute node handling during string() conversion may be incorrect.
I found what looks like an XPath evaluation bug in the
xmllintimplementation from xmloxide.This works correctly with libxml2's
xmllint:Output:
But the xmloxide implementation returns the anchor text instead:
Output:
(
xmllint-rsabove is just the local alias I use for the xmloxide version to avoid confusion with libxml2'sxmllint.)Expected behavior is for the XPath expression to evaluate to the attribute value (
href), not the text content of the<a>element.Looks like attribute node handling during
string()conversion may be incorrect.