Forum Discussion

garrmark's avatar
garrmark
New Contributor
9 years ago
Solved

How do I get rid of xsi:nil when setting an elements text using groovy

I'm trying to set the text of an xml element in my request that was previously set to xml:nil=true.

 

So I want:

<MyElement i:nil="true" />

to become:

<MyElement>NewText</MyElement>

My groovy script is:

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def response = groovyUtils.getXmlHolder("Step1#Response")
response["//MyElement"] = "NewText"

But I'm getting:

<MyElement i:nil="true">NewText</MyElement>

How do I get rid of the xsi:nil attribute?