下载文件时出现错误:
引用了实体“nbsp”,但未声明。
我可以下载该文件,但我无法预览该文件。 以下是我的代码:
var arr = ["", "", "", "", "", "", "", "", "", "", ""];
var el = document.getElementById("dem");
function updateData(a) {
el.innerHTML = a.join('');
}
function changeData() {
for (i = 0; i < arr.length; i++) {
arr[i] = Math.floor(Math.random() * 2) ? "|" : "1";
}
updateData(arr);
}
setInterval(changeData, 500);
我尝试将<div class="bdy" >
<p id="dem">AHAHHAHAHH!!!</p>
</div>
替换为is = new ByteArrayInputStream(articleHtml.getBytes());
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
Document doc = builder.parse(is, null);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(doc, null);
renderer.layout();
try {
renderer.createPDF(outputStream);
} catch (com.lowagie.text.DocumentException e) {
e.printStackTrace();
}
。请帮我解决这个问题。
答案 0 :(得分:0)
您是否尝试过将声明实体声明为?
<!DOCTYPE test [
<!ENTITY nbsp " ">
]>
<test>The Spanish word for "Spain" is "Espa a" Dagon his Name, Sea Monster</test>