Anonymous
6 years agogetNodeValue return null if I add ns
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CheckCity xmlns="http://some ns here"> <Result> <table> <country>CountryA</country> <city>CityA</city> </table> <table> <country>CountryB</country> <city>cityB</city> </table> <table> <country>CountryC</country> <city>cityC</city> </table> </Result> </CheckCity> </soap:Body> </soap:Envelope>
I need to check that CountyA has city A, CountryB has city B, CountryC hs City C
I can't city value for the country. getNOdeValue returns null
def groovyUtils=new com.eviware.soapui.support.GroovyUtils(context) def holder=groovyUtils.getXmlHolder("SOAP#Response") def soap = new groovy.xml.Namespace("http://schemas.xmlsoap.org/soap/envelope/", 'soap') holder.namespaces["ns"] = "http://some ns here" def a = holder.getNodeValue("//ns:table[country='CountryA']//*:city") log.info a
If I remove ns from xml and use smth like def a = holder.getNodeValue("//*:table[country='CountryA']//*:city") works ok