我试图将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>错误
元素类型"chat“必须声明。
发布于 2018-05-09 21:06:51
帕斯-试试这个
<!DOCTYPE chat [
<!ELEMENT chat (note*)>
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>https://stackoverflow.com/questions/50261805
复制相似问题