File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
validator/src/main/java/org/lfenergy/compas/scl/validator/xsd Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
import org .lfenergy .compas .scl .validator .exception .SclValidatorException ;
7
7
8
+ import javax .xml .XMLConstants ;
8
9
import javax .xml .stream .XMLInputFactory ;
9
10
import javax .xml .stream .XMLStreamException ;
10
11
import javax .xml .stream .events .StartElement ;
@@ -26,7 +27,7 @@ public class SclInfo {
26
27
27
28
public SclInfo (String sclData ) {
28
29
try (var fis = new ByteArrayInputStream (sclData .getBytes (StandardCharsets .UTF_8 ))) {
29
- var xmlInputFactory = XMLInputFactory . newInstance ();
30
+ var xmlInputFactory = getXMLInputFactory ();
30
31
var reader = xmlInputFactory .createXMLEventReader (fis );
31
32
32
33
while (reader .hasNext ()) {
@@ -62,4 +63,13 @@ public String getRevision() {
62
63
public String getRelease () {
63
64
return release ;
64
65
}
66
+
67
+ private XMLInputFactory getXMLInputFactory () {
68
+ var xmlInputFactory = XMLInputFactory .newInstance ();
69
+ xmlInputFactory .setProperty (XMLInputFactory .SUPPORT_DTD , false );
70
+ xmlInputFactory .setProperty (XMLInputFactory .IS_SUPPORTING_EXTERNAL_ENTITIES , Boolean .FALSE );
71
+ xmlInputFactory .setProperty (XMLConstants .ACCESS_EXTERNAL_DTD , "" );
72
+ xmlInputFactory .setProperty (XMLConstants .ACCESS_EXTERNAL_SCHEMA , "" );
73
+ return xmlInputFactory ;
74
+ }
65
75
}
You can’t perform that action at this time.
0 commit comments