title: What will be the code fix for the following XML External Entity Injection issue in java code?
body: <pre><code>DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder Builder = dbf.newDocumentBuilder();
  Element e = builder.parse(getConfigFileStream()).getDocumentElement();
  fromXML(e); 
  </code></pre>
  <p>Fortify is showing XML EE issue in Element e = builder.parse line and the suggested fix is the usual factory.setFeature that doesn't works for this case,someone please help with a fix that might work.The default explanation is that an Xml parser should be configured securely so that it doesn't allow external entities as part of incoming XML Document</p>
  <p>Tried Fix:</p>
  <pre><code>dbf.setFeature(&quot;http://xml.org/sax/features/external-general-entities&quot;,false);
  dbf.setFeature(http://xml.org/sax/features/external-parameter-entities&quot;,false);
  </code></pre>