XML 实体 - 我的代码有什么问题?
XML Entity- what's wrong with my code?
我正在 XML 参加 class,我必须阅读这本名为 "INeasysteps" 的书。我正在尝试遵循有关 "Adding Comments and Entities" 的教程之一,但是当我将其放入浏览器时,我不断收到响应:
Blockquote XML Parsing Error: undefined entity
Line Number 11, Column 13:
Blockquote
这是我的代码:请让我知道我做错了什么。仅供参考,Jedit 解析器中没有错误,但是当我将 xml 代码放入浏览器时出现上述错误:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- XML in easy steps - Page 40. -->
<?xml-stylesheet
type = "text/css" href = "history.css" ?>
<!DOCTYPE doc SYSTEM "history.dtd" >
<doc>
<para>Both &html; and &xml; are derived from &sgml; which is, in turn, a descendant of the &gml; that was developed in the 1960s by IBM. </para>
</doc>
这是 history.dtd 文件
<!-- Define the root element. -->
<!-- May contain one child element called para. -->
<!ELEMENT doc (para)>
<!-- Define the child element. -->
<!-- May contain Parsed Character Data. -->
<!ELEMENT para (#PCDATA)>
<!-- Define entity values. -->
<!-- Common markup language acronyms. -->
<!ENTITY html
"HyperText Markup Language (HTML)" >
<!ENTITY xml
"eXtensible Markup Language (XML)" >
<!ENTITY sgml
"Standard Generalized Markup Language (SGML)" >
<!ENTITY gml
"Generalized Markup Language (GML)" >
大多数浏览器不会加载外部实体。如果要在浏览器中打开 XML 文件并正确解析实体,请将实体声明添加到内部子集(文档类型声明中的 [
和 ]
之间):
<?xml version="1.0" encoding="UTF-8" ?>
<!-- XML in easy steps - Page 40. -->
<?xml-stylesheet type="text/css" href = "history.css" ?>
<!DOCTYPE doc SYSTEM "history.dtd" [
<!ENTITY html "HyperText Markup Language (HTML)" >
<!ENTITY xml "eXtensible Markup Language (XML)" >
<!ENTITY sgml "Standard Generalized Markup Language (SGML)" >
<!ENTITY gml "Generalized Markup Language (GML)" >
]>
<doc>
<para>Both &html; and &xml; are derived from &sgml; which is, in turn, a
descendant of the &gml; that was developed in the 1960s by IBM. </para>
</doc>
我正在 XML 参加 class,我必须阅读这本名为 "INeasysteps" 的书。我正在尝试遵循有关 "Adding Comments and Entities" 的教程之一,但是当我将其放入浏览器时,我不断收到响应:
Blockquote XML Parsing Error: undefined entity Line Number 11, Column 13: Blockquote
这是我的代码:请让我知道我做错了什么。仅供参考,Jedit 解析器中没有错误,但是当我将 xml 代码放入浏览器时出现上述错误:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- XML in easy steps - Page 40. -->
<?xml-stylesheet
type = "text/css" href = "history.css" ?>
<!DOCTYPE doc SYSTEM "history.dtd" >
<doc>
<para>Both &html; and &xml; are derived from &sgml; which is, in turn, a descendant of the &gml; that was developed in the 1960s by IBM. </para>
</doc>
这是 history.dtd 文件
<!-- Define the root element. -->
<!-- May contain one child element called para. -->
<!ELEMENT doc (para)>
<!-- Define the child element. -->
<!-- May contain Parsed Character Data. -->
<!ELEMENT para (#PCDATA)>
<!-- Define entity values. -->
<!-- Common markup language acronyms. -->
<!ENTITY html
"HyperText Markup Language (HTML)" >
<!ENTITY xml
"eXtensible Markup Language (XML)" >
<!ENTITY sgml
"Standard Generalized Markup Language (SGML)" >
<!ENTITY gml
"Generalized Markup Language (GML)" >
大多数浏览器不会加载外部实体。如果要在浏览器中打开 XML 文件并正确解析实体,请将实体声明添加到内部子集(文档类型声明中的 [
和 ]
之间):
<?xml version="1.0" encoding="UTF-8" ?>
<!-- XML in easy steps - Page 40. -->
<?xml-stylesheet type="text/css" href = "history.css" ?>
<!DOCTYPE doc SYSTEM "history.dtd" [
<!ENTITY html "HyperText Markup Language (HTML)" >
<!ENTITY xml "eXtensible Markup Language (XML)" >
<!ENTITY sgml "Standard Generalized Markup Language (SGML)" >
<!ENTITY gml "Generalized Markup Language (GML)" >
]>
<doc>
<para>Both &html; and &xml; are derived from &sgml; which is, in turn, a
descendant of the &gml; that was developed in the 1960s by IBM. </para>
</doc>