Reputation: 1168
I am trying to apply DTD to a XML Document(I am new to XML). I am getting the following errors in the code. Also is there a better way apart from this to apply 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>
Error
Element type "chat" must be declared.
Upvotes: 0
Views: 75
Reputation: 49
Parth - Try this
<!DOCTYPE chat [
<!ELEMENT chat (note*)>
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
Upvotes: 1