Forum Discussion
shubhimu
7 years agoContributor
Yeah i know this and its working for me ..
But i dont want to break it in to n number of variables.
I want one variable should suffice the purpose...
Please let me know if we can do this way.
Thanks,
Himanshu
shubhimu
7 years agoContributor
I got the solution.
def xml=getNodes(resource,xpaths)
log.info xml.did.size()
def getNodes(doc,path){
def nodes = doc;
path.split("\\.").each {
log.info "node size for "+ "${it}" +" is "+nodes.size()
if(nodes.size() == 1){
nodes = nodes."${it}";
}else{
nodes = nodes[0]."${it}"
}
log.info "${it}"
}
log.info "Nodes is "+nodes
return nodes
}