Forum Discussion
omatzura
17 years agoSuper Contributor
Hi!
ok.. so the following code will add a new ProdSet with default attributes and a contained ProductServiceId:
ok?
regards!
/Ole
eviware.com
ok.. so the following code will add a new ProdSet with default attributes and a contained ProductServiceId:
import groovy.xml.dom.DOMCategory
import groovy.xml.QName
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
// get the xml to update
def holder = groovyUtils.getXmlHolder( "Request 1#Request" )
// get parent node for new child
def node = holder.getDomNode( "//prod1:request" )
// use DOMCategory to simplify things..
use( DOMCategory )
{
def ns = "http://xyz.ca/ebusiness/ProductService"
// add new "ProdSet" element..
def prodSet = node.appendNode( new QName( ns, "ProdSet", "prod1"))
// set its attributes
prodSet.setAttribute( "DestCountryCode", "?" )
prodSet.setAttribute( "ContractNumber", "?" )
// add new "ProductServiceId" element with "?" value..
prodSet.appendNode( new QName( ns, "ProductServiceId", "prod1"), "?" ) }
}
holder.updateProperty()
ok?
regards!
/Ole
eviware.com
Related Content
- 4 years ago
- 5 years ago
- 10 months ago
Recent Discussions
- 15 years ago