XmlStringUtil { public static String removeAllNsPrefixes(String xmlString) { return xmlString.replaceAll("<[a-zA-Z0-9]*:", "<").replaceAll("</[a-zA-Z0-9]*:", "</"); }  static String removeAllNsPrefixes(String xmlString); static String removeTags(String document);  }
@Test public void testRemoveAllNsPrefixes() { final String xmlWithNs = "<ns1:root><ns2:elem attr=\"v:a:l:u:e\">&lt;=:o)</ns2:elem></ns1:root>"; String cleanedXml = XmlStringUtil.removeAllNsPrefixes(xmlWithNs); assertEquals("<root><elem attr=\"v:a:l:u:e\">&lt;=:o)</elem></root>", cleanedXml); assertEquals("", XmlStringUtil.removeAllNsPrefixes("")); }