org.activiti.explorer.util.XmlUtil Maven / Gradle / Ivy
package org.activiti.explorer.util;
import javax.xml.stream.XMLInputFactory;
/**
* @author Joram Barrez
*/
public class XmlUtil {
public static XMLInputFactory createSafeXmlInputFactory() {
XMLInputFactory xif = XMLInputFactory.newInstance();
if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {
xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
}
if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) {
xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
}
if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) {
xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
}
return xif;
}
}