File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
kilo-client/src/main/java/org/httprpc/kilo/xml Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ public int size() {
6464 private static final String ATTRIBUTE_PREFIX = "@" ;
6565 private static final String LIST_SUFFIX = "*" ;
6666
67+ private static final String XERCES_FEATURE_PREFIX = "http://apache.org/xml/features" ;
68+
6769 /**
6870 * Constructs a new element adapter.
6971 *
@@ -318,11 +320,19 @@ public static DocumentBuilder newDocumentBuilder() {
318320 documentBuilderFactory .setExpandEntityReferences (false );
319321 documentBuilderFactory .setIgnoringComments (true );
320322
323+ DocumentBuilder documentBuilder ;
321324 try {
322- return documentBuilderFactory .newDocumentBuilder ();
325+ documentBuilderFactory .setFeature (String .format ("%s/nonvalidating/load-dtd-grammar" , XERCES_FEATURE_PREFIX ), false );
326+ documentBuilderFactory .setFeature (String .format ("%s/nonvalidating/load-external-dtd" , XERCES_FEATURE_PREFIX ), false );
327+
328+ documentBuilder = documentBuilderFactory .newDocumentBuilder ();
323329 } catch (ParserConfigurationException exception ) {
324330 throw new RuntimeException (exception );
325331 }
332+
333+ documentBuilder .setEntityResolver ((publicID , systemID ) -> null );
334+
335+ return documentBuilder ;
326336 }
327337
328338 /**
You can’t perform that action at this time.
0 commit comments