java.io.IOException:服务器返回HTTP响应代码:503为URL:http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

Jon*_*tow 5 java xslt xhtml xalan

在以下代码中:

private Document transformDoc(Source source) throws TransformerException, IOException {
    TransformerFactory factory = TransformerFactory.newInstance();

    Transformer transformer =
            factory.newTransformer(new StreamSource(xsltResource.getInputStream()));
    JDOMResult result = new JDOMResult();
    transformer.transform(source, result);
    return result.getDocument();
}
Run Code Online (Sandbox Code Playgroud)

我得到这个例外:

java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
Run Code Online (Sandbox Code Playgroud)

我通过xsl翻译的XHTML是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  <title>Terms and Conditions</title>
</head>
<body>
  <div>Test Content</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

如何阻止xalan变压器打电话回家?

mat*_*t b 1

Xalan-J 邮件列表中的这篇文章建议“正确的方法”是您自己配置底层SourceReader禁用验证。