code: public static Document convertToElementNode(String xmlString) throws Exception {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
      	   // Fortify Mod: Disable entity expansion to foil External Entity Injections
      	   dbf.setExpandEntityReferences(false);
             Document doc = dbf.newDocumentBuilder().newDocument();
             if (xmlString != null) {
             	    // Fortify Mod: disable external entity injection
                TransformerFactory tf = TransformerFactory.newInstance();
                tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
                Transformer t = tf.newTransformer();
      		    // End Fortify Mod
                t.transform(new StreamSource(new StringReader(xmlString)), new DOMResult(doc));
             }
             return doc;
         }
docs: Convert text node to element.
  @param xmlString
  @return Return the document object.
  @throws Exception