String xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?><message><sourceUri></sourceUri><body></body></message>"; | |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
factory.setNamespaceAware(false); | |
factory.setValidating(false); | |
DocumentBuilder builder = factory.newDocumentBuilder(); | |
Document document = builder.parse(new InputSource(new StringReader(xml))); | |
System.out.println(document); |