java dtd验证xml_Java,xml,XSLT:防止DTD验证

我使用Java(6)XML-Api在Web上的html文档上应用xslt转换。本文档的格式正确,是xhtml,因此包含有效的DTD-

Spec(/p>

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">)。现在出现一个问题:Uppon转换XSLT-

Processor尝试下载DTD,而w3-server则由于HTTP

503错误(由于w3的带宽限制)而拒绝了它。

如何防止XSLT处理器下载dtd? 我不需要我的输入文档经过验证。

来源是:

import javax.xml.transform.Source;

import javax.xml.transform.Transformer;

import javax.xml.transform.TransformerFactory;

import javax.xml.transform.stream.StreamResult;

import javax.xml.transform.stream.StreamSource;

-

String xslt = ""+

""+

" "+

" "+

" "+

" "+

" "+

"";

try {

Source xmlSource = new StreamSource("http://de.wikipedia.org/wiki/Right_Livelihood_Award");

Source xsltSource = new StreamSource(new StringReader(xslt));

TransformerFactory ft = TransformerFactory.newInstance();

Transformer trans = ft.newTransformer(xsltSource);

trans.transform(xmlSource, new StreamResult(System.out));

}

catch (Exception e) {

e.printStackTrace();

}

我在此处阅读了以下问题,但它们都使用另一个XML-Api:

谢谢!

你可能感兴趣的:(java,dtd验证xml)