working on #774
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
- #722
|
||||||
|
- #774
|
||||||
|
|
||||||
2.16.3
|
2.16.3
|
||||||
=======
|
=======
|
||||||
2025-03-03
|
2025-03-03
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.mustangproject.ClasspathResolverURIAdapter;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
import javax.xml.transform.*;
|
import javax.xml.transform.*;
|
||||||
import javax.xml.transform.sax.SAXResult;
|
import javax.xml.transform.sax.SAXResult;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
@@ -118,6 +119,11 @@ public class ValidationLogVisualizer {
|
|||||||
|
|
||||||
// Step 4: Setup JAXP using identity transformer
|
// Step 4: Setup JAXP using identity transformer
|
||||||
TransformerFactory factory = TransformerFactory.newInstance();
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
|
|
||||||
|
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
|
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
Transformer transformer = factory.newTransformer(); // identity transformer
|
Transformer transformer = factory.newTransformer(); // identity transformer
|
||||||
|
|
||||||
// Step 5: Setup input and output for XSLT transformation
|
// Step 5: Setup input and output for XSLT transformation
|
||||||
|
|||||||
@@ -356,6 +356,10 @@ public class ZUGFeRDVisualizer {
|
|||||||
|
|
||||||
// Step 4: Setup JAXP using identity transformer
|
// Step 4: Setup JAXP using identity transformer
|
||||||
TransformerFactory factory = TransformerFactory.newInstance();
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
|
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
|
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
Transformer transformer = factory.newTransformer(); // identity transformer
|
Transformer transformer = factory.newTransformer(); // identity transformer
|
||||||
|
|
||||||
// Step 5: Setup input and output for XSLT transformation
|
// Step 5: Setup input and output for XSLT transformation
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ public abstract class Validator {
|
|||||||
Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData));
|
Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData));
|
||||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||||
try {
|
try {
|
||||||
|
schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
|
schemaFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
schemaFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
schemaFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
Schema schema = schemaFactory.newSchema(schemaFile);
|
Schema schema = schemaFactory.newSchema(schemaFile);
|
||||||
javax.xml.validation.Validator validator = schema.newValidator();
|
javax.xml.validation.Validator validator = schema.newValidator();
|
||||||
validator.validate(xmlData);
|
validator.validate(xmlData);
|
||||||
|
|||||||
Reference in New Issue
Block a user