Consider an XML file called intro.xml and a document type defintion (DTD) file intro.dtd as follows:
intro.xml
<?xml version = "1.0"?>
<!DOCTYPE myMessage SYSTEM "intro.dtd"›
<myMessage>
<message>Welcome to XML</message>
</myMessage>
intro.dtd
<! ELEMENT myMessage (message)>
<! ELEMENT message (#PCDATA)>
A validating parser will classify intro.xml as
- Well-formed and validated
- Well-formed but not validated
- Validated but not well-formed
- Neither validated nor well-formed