I have small Strings with XML, like:
String myxml = \"good hi \";
<
@The comments of this answer:
You can create a method to make it look simpler
String xml = "good hi ";
System.out.printf("satus= %s\n", getValue("/resp/status", xml ) );
The implementation:
public String getValue( String path, String xml ) {
return XPathFactory
.newInstance()
.newXPath()
.evaluate( path , new InputSource(
new StringReader(xml)));
}