Skip to content

Commit

Permalink
Remove setting the access external for XML parsing factories (#199)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
  • Loading branch information
flo-dup committed Dec 2, 2020
1 parent 019cfec commit 8ce5167
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.powsybl.commons.exceptions.UncheckedTransformerException;
import org.w3c.dom.Document;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand All @@ -33,8 +32,6 @@ private DomUtil() {
public static DocumentBuilder getDocumentBuilder() {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
return dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new UncheckedParserConfigurationException(e);
Expand All @@ -46,8 +43,6 @@ public static void transformDocument(Document document, Writer writer) {
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(writer);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
Expand Down

0 comments on commit 8ce5167

Please sign in to comment.