Hi,
There is no step and/or public function and/or public method available within DevTest AFAIK. So, within an "Execute Script" step you would be able to do this with some java coding, and in that case StackOverflow often becomes your best friend (as it was mine for the below).
So try below code. There is one caveat: your source XML contains whitespace between the elements, and the XML transformer did not output the xml tags on different lines until I removed that whitespace. That's why the first action is a replaceAll() call. BUT, as it is right now this for any xml element that has only spaces as content, this line would also remove those. So an element like <someTag> <someTag> would become <someTag><someTag>
After the script runs the formatted xml would be stored in a property called "formattedXML"
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
String sourceXml = lisa_vse_request.getBodyText();
sourceXml = sourceXml.replaceAll(">\\s++<", "><");
//Parser that produces DOM object trees from XML content
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//API to obtain DOM Document instance
DocumentBuilder builder = null;
//Create DocumentBuilder with default configuration
builder = factory.newDocumentBuilder();
//Parse the content to Document object
Document doc = builder.parse(new InputSource(new StringReader(sourceXml)));
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
//initialize StreamResult with File object to save to file
StreamResult result = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(doc);
transformer.transform(source, result);
String xmlString = result.getWriter().toString();
testExec.setStateValue("formattedXML", xmlString)
Hope this helps.
Cheers,
Danny