I have XML in the form of a String that contains
HELLO!
How can I get the String \"Hello!\" from the XML?
You could also use tools provided by the base JRE:
String msg = "HELLO! ";
DocumentBuilder newDocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document parse = newDocumentBuilder.parse(new ByteArrayInputStream(msg.getBytes()));
System.out.println(parse.getFirstChild().getTextContent());