Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID


We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

XML DTD Assistance

Good evening!

I am working on an assignment where I create DVD database in XML and validate it with a DTD. I believe that I have accomplished this, but I would like someone to look at it and tell me if you see any issues. So far, everything validates fine, in other words no errors when displayed in an Internet Explorer window. However, I would like to make sure that I am hitting the right points.

DVDs.dtd file


<?xml version="1.0" encoding="UTF-8"?>

<!ELEMENT DVD (title, genre, movieRating, viewerRating, summary, year, director, runtime, studio, actors)>

<!ELEMENT title (#PCDATA)>

<!ELEMENT genre (#PCDATA)>
<!ATTLIST genre kind (action | comedy | drama | family | foreign | horror | musical | other) #REQUIRED >

<!ELEMENT movieRating (#PCDATA)>
<!ATTLIST movieRating rating (G | PG | PG-13 | R | NC-17) #REQUIRED >

<!ELEMENT viewerRating (#PCDATA)>
<!ATTLIST viewerRating rating (1 | 2 | 3 | 4 | 5) #REQUIRED >

<!ELEMENT summary (#PCDATA)>


<!ELEMENT director (#PCDATA)>

<!ELEMENT runtime (#PCDATA)>

<!ELEMENT studio (#PCDATA)>

<!ELEMENT actors (actor)+>
<!ELEMENT actor (first, last)>
<!ELEMENT actor (#PCDATA)>
<!ELEMENT first (#PCDATA)>




<?xml version="1.0" encoding="UTF-8" ?>


Star Wars Episode IV: A New Hope
Young hero Luke Skywalker joins the Rebel Alliance to help overthrow the tyrannical Galactic Empire.

George Lucas
20th Century Fox





Main points that I am concerned about:

1) 'movieRatings' should only be one of the choices in the enumerated list (G, PG, etc.). When I tried to enter a different value in the xml file, it still validated in the Internet Explorer window (i.e. no errors). I thought it would fly unless it was one of the predetermined choices?

2) Although it does not specify in the assignment description, I would like to do something similar with 'viewerRating'. In other words, only a number of 1 to 5 may be entered.

3) Each actor has to have their first and last name listed and is to have a unique identifier. I think I did it right but would like to be sure.

Any and all suggestions, comments or observations are welcome. Thanks in advance!


Sign In or Register to comment.