Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

xml - Entity was referenced but not declared

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...