Forum Discussion
def holder = groovyUtils.getXmlHolder(context.expand('${ListColors - Request 1#Response}'))
Before all I had to use is :
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "ListColors#Response" )
and it worked. Did the synthax changed in the new version ?
Could you please share the full code.... I want to remove empty parent tags in my request XML. Please help
I tried these 2 not working
1)
def holder = groovyUtils.getXmlHolder(context.expand('${Request 1#Request}'))
for( item in holder.getDomNodes( "//*[normalize-space(.) = '' and count(*) = 0]" ))
{
item.removeXobj()
}
holder.updateProperty()
context.requestContent = holder.xml
2)
testRunner.testCase.testSteps.each
{
it->
if (it.getValue().config.type.equals("restrequest"))
{
def x = it.getValue().getName();
//def groovyUtils = new com.eviware.soapui.support.GroovyUtils
def holder = groovyUtils.getXmlHolder(context.expand('${x#Request}'))
// find end nodes that also only consist of whitespace
for( item in holder.getDomNodes( "//*[normalize-space(.) = '' and count(*) = 0]" ))
{
item.removeXobj()
}
holder.updateProperty()
context.requestContent = holder.xml
}
}
Related Content
- 9 years ago
- 2 years ago