public Document stringToDom ( String xmlSource ) throws S2SException { try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( new InputSource ( new StringReader ( xmlSource ) ) ) ; } catch ( SAXException | IOException | ParserConfigurationException ex ) { throw new S2SException ( ex . getMessage ( ) , ex ) ; } }
This method convert xml string in to a Document