Search and Replace within XML
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2012
02:09 AM
04-23-2012
02:09 AM
Search and Replace within XML
Hiya
One of my tests requires me to transfer over a large amount of XML from a response message into a new request. When this happens it transfers over the original namespaces as well as the included text/attributes. Does anyone know if there is a way to either:
a) Stop the namespaces being transferred in the Property Transfer
b) Offer another way of transferring a large set of nodes/child nodes so the namespaces are not transferred
c) Script a simple search and replace to amend the namespaces and to include removal of un-necessary xslt's?
Right now, this is a manual process which is taking a long time to complete and means these scripts cannot be automated.
thanks
One of my tests requires me to transfer over a large amount of XML from a response message into a new request. When this happens it transfers over the original namespaces as well as the included text/attributes. Does anyone know if there is a way to either:
a) Stop the namespaces being transferred in the Property Transfer
b) Offer another way of transferring a large set of nodes/child nodes so the namespaces are not transferred
c) Script a simple search and replace to amend the namespaces and to include removal of un-necessary xslt's?
Right now, this is a manual process which is taking a long time to complete and means these scripts cannot be automated.
thanks
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2012
03:07 AM
04-23-2012
03:07 AM
Hi,
I dont understand why you wanna stop transfering namespace. Without it your xml can be invalid. Can you show here some example
I dont understand why you wanna stop transfering namespace. Without it your xml can be invalid. Can you show here some example
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2012
03:30 AM
04-23-2012
03:30 AM
You can create groovy script:
and then in property transfer
source testCase and find this new property
Target: requestName Property Request
// get response
def response = context.expand( '${RequestName#Response}' )
// do some replace
response = response.replaceAll("", "")
// save response as property in tesCase
def tc = testRunner.testCase
tc.setPropertyValue("response",response)
and then in property transfer
source testCase and find this new property
Target: requestName Property Request
