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

后端 未结 2 1431
广开言路
广开言路 2021-01-13 07:40

In the following code:

private Document transformDoc(Source source) throws TransformerException, IOException {
    TransformerFactory factory = TransformerFa         


        
2条回答
  •  無奈伤痛
    2021-01-13 08:29

    Either disable DTD resolving in the parser (parser-specific) or set an empty entity resolver.

    Copied from 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());
    

提交回复
热议问题