gpt4 book ai didi

java.io.IOException : Server returned HTTP response code: 503 for URL: http://www. w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

转载 作者:搜寻专家 更新时间:2023-10-31 20:24:25 25 4
gpt4 key购买 nike

在下面的代码中:

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();
}

我得到这个异常:

java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

我通过 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>

我如何阻止 xalan 变压器给家里打电话?

最佳答案

要么在解析器中禁用 DTD 解析(特定于解析器),要么设置一个空的实体解析器。

复制自http://www.jdom.org/docs/faq.html#a0350 :

public class NoOpEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(new StringBufferInputStream(""));
}
}

// Then in the builder...

builder.setEntityResolver(new NoOpEntityResolver());

关于java.io.IOException : Server returned HTTP response code: 503 for URL: http://www. w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2502581/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com