I've had a quick look at the DTD we produced in class and found the problem. The attribute declaration we had down as:
<!ATTLIST attraction type CDATA (restaurant|museum|bar|gallery|other) "other">
Should have been:
<!ATTLIST attraction type (restaurant|museum|bar|gallery|other) "other">
The erroneous type declaration of the attribute "type" (we should have chosen better labels for our attributes!) meant that the parser expected the material in parentheses to be the default, hence it asked for quotation marks. I've uploaded a corrected version into dropbox (hacking_2_4_dtd_master.dtd). If you want to try and validate it, cut and paste the code into this validator:
http://www.validome.org/grammar/
If you want to go a step further and want to check that the xml document we created validates against our DTD, you can use this validator:
http://www.xmlvalidation.com/
First cut and paste the XML file into the box and then click 'validate'. The site will then ask you where the DTD is. Cut and paste the DTD into the next box and then click 'continue validation'. It should validate, meaning that the xml document conforms to the rules set out in the DTD.
A question: how does the online validator know what our DTD is called? See if you can find the bit of code that says this.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.