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

后端 未结 2 1412
广开言路
广开言路 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:26

    This post from the Xalan-J mailing list suggests that "the right way" is for you to configure the underlying Source/Reader yourself to disable validation.

    0 讨论(0)
  • 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());
    
    0 讨论(0)
提交回复
热议问题