翻译

实体”“被引用,但没有声明

问题

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

原因

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

解决

方法1.

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

方法2.

html转换为XML格式的时候html里面含有&nbsp会出现The entity "nbsp" was referenced, but not declared.这个异常,解决的办法是把&nbsp替换成&#160即可!

The entity "nbsp" was referenced, but not declared的更多相关文章

  1. How to: Use the Entity Framework Model First in XAF 如何:在 XAF 中使用EF ModelFirst

    This topic demonstrates how to use the Model First entity model and a DbContext entity container in ...

  2. Property referenced in indexed property path is neither an array nor a List nor a Map

    记一次传参请求报错,没有解决 Invalid property 'distributeCars[0][ackStatus]' of bean class [com.api6.plate.prototy ...

  3. 13.1.17 CREATE TABLE Syntax

    13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...

  4. An entity object cannot be referenced by multiple instances of IEntityChangeTracker 的解决方案

    使用EF对建立了关系的表新增记录时出现: An entity object cannot be referenced by multiple instances of IEntityChangeTra ...

  5. org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:

    详细错误堆栈信息: org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" ...

  6. EntityFramework 异常 -- An entity object cannot be referenced by multiple instances of IEntityChangeTracker

    问题      在调用 DbSet 的 Attach()  方法时(与将 Entity 设置为 EntityState.Unchanged 状态等价)报告以下错误:      An entity ob ...

  7. EF异常探究(An entity object cannot be referenced by multiple instances of IEntityChangeTracker.)

    今天在改造以前旧项目时出现了一项BUG,是由于以前不规范的EF写法所导致.异常信息如下: "An entity object cannot be referenced by multiple ...

  8. An entity object cannot be referenced by multiple instances of IEntityChangeTracker.

    如果你和我一样遇到了这个问题,那么你就要检查你要操作的Model对象查询,更新操作的数据库上下文也就是DBContext是否一致.如果不一致也就是说你用AContext去查如AContext.SET& ...

  9. How to: Use the Entity Framework Data Model Located in an External Assembly 如何:使用位于外部程序集中的EF数据模型

    If you have a non-XAF application, and want to develop an XAF application that utilizes the same dat ...

随机推荐

  1. Java 创建类的过程

    创建对象过程: 堆分配父类空间 堆分类子类空间 属性初始化 调用构造方法(第一行是调用父类构造方法)

  2. mui + H5 调取摄像头和相册 实现图片上传

    最近要用MUI做项目,在研究图片上传时 ,遇到了大坑 ,网上搜集各种资料,最终写了一个demo,直接看代码.参考(http://www.cnblogs.com/richerdyoung/p/66123 ...

  3. Covisibility Graph

    在Orb-Slam中有三个地图分别是Covisibility Graph,Spanning Graph,以及Essential Graph,它们三个分别是什么意思呢? 首先,图优化是目前视觉SLAM里 ...

  4. shell里脚本里写个简单的函数,显示颜色

    如果多次用到颜色显示,还是定义一个函数比较实在,具体什么颜色上网找一下 #!/bin/bash # 定义一个红色显示的函数 function echo_red () { local what=$* e ...

  5. 第二代网关GateWay搭建流程

    Spring Cloud第二代网关GateWay是由纯Netty开发,底层为Reactor,WebFlux构建,不依赖任何Servlet容器,它不同于Zuul,使用的是异步IO,性能较Zuul提升1. ...

  6. java连接外部接口获取数据工具类

    package com.yqzj.util; import org.apache.log4j.LogManager;import org.apache.log4j.Logger; import jav ...

  7. Java面试宝典2017

    JAVA面试.笔试题(2017版)                 欲想成功,必须用功!   目录 一.                  HTML&CSS部分................ ...

  8. python,openpyxl,读写excel文件

    import openpyxl as oxl from openpyxl.utils import get_column_letter, column_index_from_string import ...

  9. [LC] 271. Encode and Decode Strings

    Design an algorithm to encode a list of strings to a string. The encoded string is then sent over th ...

  10. ddt-python测试数据驱动工具(转载)

    背景 python 的unittest 没有自带数据驱动功能. 所以如果使用unittest,同时又想使用数据驱动,那么就可以使用DDT来完成. DDT是 “Data-Driven Tests”的缩写 ...