### Question:
MsoRequest { public static String domToStr(Document doc) { if (doc == null) { return null; } try { StringWriter sw = new StringWriter(); StreamResult sr = new StreamResult(sw); TransformerFactory tf = TransformerFactory.newInstance(); tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); Transformer t = tf.newTransformer(); t.setOutputProperty(OutputKeys.STANDALONE, "yes"); NodeList nl = doc.getDocumentElement().getChildNodes(); DOMSource source = null; for (int x = 0; x < nl.getLength(); x++) { Node e = nl.item(x); if (e instanceof Element) { source = new DOMSource(e); break; } } if (source != null) { t.transform(source, sr); String s = sw.toString(); return s; } return null; } catch (Exception e) { logger.error("Exception in domToStr", e); } return null; }  Response buildServiceErrorResponse(int httpResponseCode, MsoException exceptionType, String errorText,
            String messageId, List<String> variables, String version); void parse(ServiceInstancesRequest sir, Map<String, String> instanceIdMap, Actions action, String version,
            String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag); Map<String, List<String>> getOrchestrationFilters(MultivaluedMap<String, String> queryParams); InfraActiveRequests createRequestObject(ServiceInstancesRequest servInsReq, Actions action, String requestId,
            Status status, String originalRequestJSON, String requestScope); InfraActiveRequests createRequestObject(TasksRequest taskRequest, Action action, String requestId,
            Status status, String originalRequestJSON); void createErrorRequestRecord(Status status, String requestId, String errorMessage, Actions action,
            String requestScope, String requestJSON, String serviceInstanceId); Response buildResponse(int httpResponseCode, String errorCode, InfraActiveRequests inProgress); Response buildResponseWithError(int httpResponseCode, String errorCode, InfraActiveRequests inProgress,
            String errorString); Response buildResponseFailedValidation(int httpResponseCode, String exceptionMessage); String getServiceType(VnfInputs vnfInputs); long translateStatus(RequestStatusType status); static String domToStr(Document doc); void addBPMNSpecificInputs(VnfRequest vnfReq, VnfInputs vnfInputs, String personaModelId,
            String personaModelVersion, Boolean isBaseVfModule, String vnfPersonaModelId,
            String vnfPersonaModelVersion); String getRequestJSON(ServiceInstancesRequest sir); boolean getAlacarteFlag(ServiceInstancesRequest sir); String getNetworkType(ServiceInstancesRequest sir, String requestScope); String getServiceInstanceType(ServiceInstancesRequest sir, String requestScope); String getSDCServiceModelVersion(ServiceInstancesRequest sir); String getVfModuleType(ServiceInstancesRequest sir, String requestScope); String getVnfType(ServiceInstancesRequest sir, String requestScope);  }### Answer:
@Test public void domToStrTest() throws Exception { String xmlStr = "<dummy><service-instance-id>1234</service-instance-id></dummy>"; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new InputSource(new StringReader(xmlStr))); String result = MsoRequest.domToStr(document); assertNotNull(result); }