Entity was referenced but not declared

让人想犯罪 __ 提交于 2019-12-17 20:58:01

问题


In my xml file of Spring MVC application for using tiles, I have written the following -

<definition name="dashboard" extends="base.definition">
        <put-attribute name="title" value="Dashboard - CMS &diams; &reg; Galactic NetOne" />
        <put-attribute name="body" value="/WEB-INF/views/dashboard.jsp" />
</definition>

However, &diams; and &reg; give the error that they are referenced but not declared. Please help.


回答1:


You either need to declare those entities, or replace them with a hex or decimal equivalent. I'm assuming what the characters are supposed to be for diams and reg; you may need to change them.

Example of declaring the entities:

<!DOCTYPE definition [
<!ENTITY reg "&#174;">
<!ENTITY diams "&#9830;">
]>
<definition name="dashboard" extends="base.definition">
    <put-attribute name="title" value="Dashboard - CMS &diams; &reg; Galactic NetOne" />
    <put-attribute name="body" value="/WEB-INF/views/dashboard.jsp" />
</definition>

Example of replacing the entities:

<definition name="dashboard" extends="base.definition">
    <put-attribute name="title" value="Dashboard - CMS &#9830; &#174; Galactic NetOne" />
    <put-attribute name="body" value="/WEB-INF/views/dashboard.jsp" />
</definition>

You can use the XHTML DTDs as a reference for entities: http://www.w3.org/TR/xhtml1/dtds.html#h-A2



来源:https://stackoverflow.com/questions/15858914/entity-was-referenced-but-not-declared

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