Closed benoitmasson closed 7 years ago
My bad, exactly the same issue as this one, in another context.
It is solved similarly, by replacing
xmlpath.MustCompile(`//title`) // starts from root node
by
xmlpath.MustCompile(`title`) // starts from the element
or
xmlpath.MustCompile(`./title`)
Hello,
I'm facing an issue there, I don't know if this is standard XPath behavior or a bug in the lib...
Consider this XML string:
and this basic function:
It is meant to iterate through the
<element>
of the XML, and for each of them, extract with a sub-XPath their title.The output is (I removed newlines and tabs, for clarity sake):
i.e., elements are iterated correctly, but titles are extracted from the
root
node (the same result is obtained if I usetitlePath := xmlpath.MustCompile("/list/element/title")
, while I clearly specified to parse from theelement
node...Does anybody know what is going on here?
Thank you