How do you declare a the “nbsp” entity in XML document

丶灬走出姿态 提交于 2019-12-19 11:42:53

问题


I am getting the following error

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

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!


回答1:


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>


来源:https://stackoverflow.com/questions/34904606/how-do-you-declare-a-the-nbsp-entity-in-xml-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!