Storing xml response
Hi all, I am trying to split an xml response by using a tag but before that I need to store my response xml in a string variable. I am using JavaScript (as per my project requirement) in custom assertion.Please kindly help me how to store the response xml in a string variable first so that i can proceed with further scripting.
I am using
var splitResp = "Response_XML".split(""); //used tag priceList
But it is not able to fetch the response xml first.I am bit new to Parasoft so a little help would mean a lot.
Comments
-
The XML Data Bank should be used to perform extractions from XML documents. The tool lets you extract all or part of the response, which ever part you desire. I recommend avoiding scripting but if you would like to script something then you can indeed reference data source and data bank columns from scripts. See Accessing Data Sources from Scripts.
There is another alternative. The "custom" assertion is a type of value assertion meaning that it receives the text content of the selected element. However, you can modify the element to use the "serialize" XPath function to return the entire element as text (as opposed to its text content). The first argument to the script will receive the result of the XPath as a string. To modify the XPath click the "Change Element" button then select "Edit XPath Manually". You can wrap the XPath with a "serialize" function like "serialize(/foo/bar)".
1