Project

Profile

Help

Bug #5957

closed

DTD Validation disabling

Added by Mark Hansen about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
High
Assignee:
Category:
JAXP Java API
Sprint/Milestone:
-
Start date:
2023-04-05
Due date:
2023-04-06
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
Java

Description

Hi,

i am trying to transform a XML file with an XSL 3.0. The XML file has a doctype declaration, but for the workflow it is not necassary to download and validating the source file. I tried a couple of things but the error was the same, that the DTD file could not be downloaded.

Here are my code:

 EnterpriseConfiguration configuration = new EnterpriseConfiguration();
 configuration.setConfigurationProperty(
      Feature.ENTITY_RESOLVER_CLASS, IgnoreDoctypeEntityResolver.class.getCanonicalName());
 configuration.setConfigurationProperty(Feature.DTD_VALIDATION, false);
 configuration.setValidation(false);
 StreamingTransformerFactory streamingTransformerFactory =
      new StreamingTransformerFactory(configuration);

 streamingTransformerFactory.setErrorListener(new StandardErrorListener());
      Transformer strTransformer =
          streamingTransformerFactory.newTransformer(
              new StreamSource(xslFile)));

 StreamSource xml = new StreamSource(onixStream);

 okFile = new File(targetDirectory.toString(), "dummy.xml");


strTransformer.transform(xml, new StreamResult(okFile));

Can you help me to solve this problem?

Please register to edit this issue

Also available in: Atom PDF