Forum Discussion
M_McDonald
13 years agoSuper Contributor
[tt:1zk7u0pu]holder.getDomNodes[/tt:1zk7u0pu] returns an array of DomNodes, not another holder object so you can't use XPath on it. An alternative would be to get the count of fault nodes and modify the XPath to access values for each one.
def indicators = []
def faultsPath = "//cth:companyTradingHistoryResponse[1]/cth:companyTradingHistoryReport[1]/thf:faults[1]" // convenience
for (n in 1..holder.getDomNodes(faultsPath + "/thf:fault").size()) {
indicators << holder.getNodeValue(faultsPath + "/thf:fault[$n]/thf:code/text()") + "_" + holder.getNodeValue(faultsPath + "/thf:fault[$n]/thf:faultString/text()")
}