Let's say I have the following XML document:
<Devices>
<Scanners>
<atom:link href="http://localhost/111" rel="http://1" />
<atom:link href="http://localhost/222" rel="http://2" />
</Scanners>
<Printers>
<atom:link href="http://localhost/333" rel="http://3" />
<atom:link href="http://localhost/444" rel="http://4" />
</Printers>
<atom:link href="http://localhost/555" rel="http://5" />
</Devices>
Using REST assured's XmlPath
I'd like to read all <atom:link>
nodes - actually their list of attributes - into a list, regardless of where the node is located in the tree. So far my code looks like this:
XmlPath xmlPath = new XmlPath(response);
// This gives me a list of five entries --> OK
List<Node> linkNodes = xmlPath.get("depthFirst().findAll { it.name() == 'link' }");
// This prints five empty lines --> NOT OK
for (Node linkNode : linkNodes) {
System.out.println(linkNode.get("@href"));
}
What am I missing here?