首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

The entity "nbsp" was referenced, but not declared

2012-10-26 
The entity nbsp was referenced, but not declared.问题? ????? 使用xhtmlrenderer将网页转成PDF时报Th

The entity "nbsp" was referenced, but not declared.
问题?

????? 使用xhtmlrenderer将网页转成PDF时报The entity "nbsp" was referenced, but not declared.异常;而某些页面却是正常。这个问题是页面中包含了 导致的,而这个标记在页面中使用是很正常且频繁了。

原因

????? 该问题是由于未定义HTML的DOCTYPE,致使SAX将内容按照xml默认定义进行解析,而xml中&开头表示可解析的实体,这个实体被DTD预先定义

解决

加入正确的DOCTYPE,如:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

热点排行