本文介绍了您如何声明"nbsp"? XML文档中的实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误

已引用实体"nbsp",但未声明.

The entity "nbsp" was referenced, but not declared.

我试图在XML文件中声明nbsp(如下所示).但这对我不起作用.

I tried to declare the nbsp (shown below) in my XML file. But this isn't working for me.

  <?xml version="1.0" encoding="UTF-8"?>
  <rss version="2.0"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  >
  <!DOCTYPE html [<!ENTITY nbsp "&#160;">

我错过了什么吗?谢谢!

Am I missing something? Thanks!

推荐答案

将DOCTYPE声明放在根元素开始标记之前.也就是说,

Put the DOCTYPE declaration before the root element start-tag. That is,

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
   <!ENTITY nbsp "&#160;">
]>
<rss version="2.0"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
 >
 ...
</rss>

这篇关于您如何声明"nbsp"? XML文档中的实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 20:03
查看更多