问题
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 " ">
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 " ">
]>
<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