### Question:
XmlUtils { public static String removeComments(String xmlStr) throws JDOMException { if (xmlStr == null) { return null; } try { SAXBuilder saxBuilder = createSAXBuilder(); Document document = saxBuilder.build(new StringReader(xmlStr)); removeComments(document); return prettyPrint(document.getRootElement()).toString(); } catch (IOException ex) { throw new RuntimeException("Xml parsing failed " + ex.getMessage(), ex); } }  static String removeComments(String xmlStr); static Element parseXml(String xmlStr); static Element parseXml(InputStream is); static String getRootAttribute(String filePath, String attributeName); static PrettyPrint prettyPrint(Element element); static PrettyPrint prettyPrint(String xmlStr); static PrettyPrint prettyPrint(Configuration conf); static void validateXml(Schema schema, String xml); static void validateData(String xmlData, SchemaName xsdFile); static String writePropToString(Properties props); static String escapeCharsForXML(String aText); static Element getSLAElement(Element elem);  }### Answer:
@Test public void testRemoveComments() throws Exception { String xmlStr = "<test1> <!-- Comment1 -->1234 <test2> ABCD <!-- Comment2 --> </test2> " + "<!-- Comment3 --> <test3> <!-- Comment4 -->EFGH </test3> <!-- Comment5 --></test1>"; String result = XmlUtils.removeComments(xmlStr); System.out.println("Result After Comments removal :\n" + result); }