翻译

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

问题

使用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. object detection模型转换成TensorFlow Lite,在Android应用

    环境 tensorflow = 1.12.0 bazel = 0.18.1 ubuntu = 16.04 python = 3.6.2 安装 bazel (0.18.1) 如果tensorflow是1 ...

  2. windows通过Winscp传输文件给Vbox虚拟机

    1.VirtualBox->设置->网络->高级->端口转发->Rule 1 TCP 127.0.0.1 22 10.0.2.15(在CentOS中通过ip addr命令 ...

  3. ant design for vue 解决 vue.esm.js?c5de:628 [Vue warn]: Invalid prop: custom validator check failed for prop "defaultValue". 的错误

    错误重现: 在使用ant design for vue 的选择器插件的时候, 设置默认为为id(为数字) 报错: 解决办法: id为数字, 而defaultValue 的key 值必须为字符串, 将i ...

  4. CodeForces 994B Knights of a Polygonal Table(STL、贪心)

    http://codeforces.com/problemset/problem/994/B 题意: 给出n和m,有n个骑士,每个骑士的战力为ai,这个骑士有bi的钱,如果一个骑士的战力比另一个骑士的 ...

  5. vim中的正则表达式替换

    这个总结的不错 http://tanqisen.github.io/blog/2013/01/13/vim-search-replace-regex/

  6. sftp安装(linux)

    --整理于网络 1. 查看openssh版本ssh -Vopenssh版本必须大于4.8p12. 创建sftp组groupadd sftp3. 创建sftp用户useradd -g sftp -s / ...

  7. 吴裕雄--天生自然 pythonTensorFlow图形数据处理:读取MNIST手写图片数据写入的TFRecord文件

    import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_dat ...

  8. 用hash存数组|得地址|取地址

    #!/usr/bin/perl -w use strict; my %hash = %{&collect};my $arr_ad=$hash{'a'};print "$arr_ad\ ...

  9. windows下pip的安装

    安装地址:https://pypi.python.org/pypi/pip#downloads 下载完成后,找到文件并进行解压,找到下面路径. 打开cmd,cd到当前目录下,然后执行下面命令: pyt ...

  10. Pandas Series 对象的loc与iloc区别

    import pandas as pd temp = pd.Series([,,,,]) loc用法: temp.loc[:] 0 1 1 2 2 3 3 4 # 输出索引为0-3的值(基于索引) t ...