【发布时间】:2018-05-10 05:06:51
【问题描述】:
我正在尝试将 DTD 应用于 XML 文档(我是 XML 新手)。我在代码中收到以下错误。除此之外还有更好的方法来应用DTD吗?
<!DOCTYPE chat [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<chat>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
</chat>
错误
必须声明元素类型“聊天”。
【问题讨论】: