Example of validation of an XML file:

  1. I created the DTD-file film.dtd with the following content:
        <!ELEMENT film (title, person+)>
        <!ELEMENT title (#PCDATA)>
        <!ELEMENT person EMPTY>
        <!ATTLIST person
          name CDATA #REQUIRED
          role (actor | photographer | director | author | administrator)
  2. I created the XML-file film.xml with the following content:
        <?xml version="1.0" ?>
        <!DOCTYPE film SYSTEM "film.dtd">
        The Postman Always Rings Twice</title>
        <person name="Lana Turner" role="actor"/>
        <person name="John Garfield" role="actor"/>
        <person name="Tay Garnet" role="director"/>
        <person name="James M. Cain" role="author"/>
  3. I put both files on the directory: http://dsv.su.se/jpalme/internet-course/xml/

  4. I accessed the validator at http://www.stg.brown.edu/service/xmlvalid/ and in the URI field wrote: http://dsv.su.se/jpalme/internet-course/xml/film.xml
     Suppress warning messages
     Relax namespace checks

  5. Then I clicked on the button in the main window of the validator and got the following response:

Validation Results for http://dsv.su.se/jpalme/internet-course/xml/film.xml

Document validates OK.