2424import javax .xml .XMLConstants ;
2525import javax .xml .parsers .DocumentBuilder ;
2626import javax .xml .parsers .DocumentBuilderFactory ;
27+ import javax .xml .parsers .ParserConfigurationException ;
2728import javax .xml .transform .OutputKeys ;
2829import javax .xml .transform .Transformer ;
2930import javax .xml .transform .TransformerException ;
@@ -169,9 +170,9 @@ private StringWriter xsltTransformationFromFile(String inputFile, String xslPath
169170
170171 // Create an instance of the TransformerFactory
171172 TransformerFactory transfomerFactory = TransformerFactory .newInstance ();
172-
173+
173174 // Obtain the XSLT transformer
174- Transformer transformer = transfomerFactory .newTransformer (new StreamSource (xslPath ));
175+ Transformer transformer = transfomerFactory .newTransformer (new StreamSource (xslPath ));
175176 transformer .setOutputProperty (OutputKeys .ENCODING , "UTF-8" );
176177 StringWriter sw = new StringWriter ();
177178 StreamResult result = new StreamResult (sw );
@@ -191,15 +192,17 @@ private void extracted() throws Exception {
191192 * @return
192193 * @throws TransformerException
193194 */
194- private StringWriter xsltTransformationFromStringWriter (StringWriter inputString , String xslPath ) throws TransformerException {
195+ private StringWriter xsltTransformationFromStringWriter (StringWriter inputString , String xslPath ) throws TransformerException , ParserConfigurationException {
195196 // second transformation
196197 DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
197198 factory .setNamespaceAware (true );
199+ factory .setFeature ("http://apache.org/xml/features/disallow-doctype-decl" , true );
200+
198201 StreamSource source = new StreamSource (new StringReader (inputString .toString ()));
199202
200203 // Create an instance of the TransformerFactory
201204 TransformerFactory transfomerFactory = TransformerFactory .newInstance ();
202-
205+
203206 // Obtain the XSLT transformer
204207 Transformer transformer = transfomerFactory .newTransformer (new StreamSource (xslPath ));
205208 transformer .setOutputProperty (OutputKeys .ENCODING , "UTF-8" );
0 commit comments