I was following the tutorial of dtd at w3schools. I copied and pasted the following onfrom a site and called it t.dtd but when i tried to validate it in Eclipse it gets an error.

I added the encoding part because it was complaining about the first line missing attributes but then it got an error for the second line.

The error says "The markup declarations contained or pointed by the document type declaration must be well-formed."

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>

Looks like a valid XML file to me.

BTW, a good site to use to check your XML for well-formedness, valid DTDs, etc is http://www.validome.org/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.