Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { private static void setUpSecurity(DocumentBuilderFactory dbFactory) throws ParserConfigurationException { dbFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); dbFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); dbFactory.setXIncludeAware(false); dbFactory.setExpandEntityReferences(false); } }