I created an XML document using Java in my android application. I have to call a web service in my application and pass this XML as an argument there. But my problem is ther
This worked for me, thank you. As a caveat, although this is actually useful for my purpose, I noticed that it can also remove text content if that consists only of whitespace. For example, running the following:
String xmlIn = " \t \t \r\n text ";
String xmlOut = xmlIn.replaceAll("(?:>)(\\s*)<", "><");
System.out.println(xmlOut);
gives the following:
text