public static Document constructDocumentFromXml ( final String xmlString ) { try { val builder = new SAXBuilder ( ) ; builder . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ; builder . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ; return builder . build ( new ByteArrayInputStream ( xmlString . getBytes ( Charset . defaultCharset ( ) ) ) ) ; } catch ( final Exception e ) { LOGGER . error ( e . getMessage ( ) , e ) ; return null ; } }
Construct document from xml string .