Closed sayanb closed 1 year ago
This is because xlink:href
is not the name of the attribute, xlink:
is a namespace prefix. So you need to either expand the namespace behind the xlink
prefix ask for that using image_node.attribute(("the-url-of-the-xlink-namespace", "href"))
or if you do not care about the namespace, filter using image_node.attributes().find(|attr| attr.name() == "href")
.
Example
<image xlink:href="tree.jpg" x="50">
Once a
Node
(let's call itimage_node
) has been obtained for this,if let Some(url) = image_node.attribute("xlink:href")
is not able to find the attributexlink:href
. However,if let Some(x) = image_node.attribute("x")
is able to find the attributex
as expected.