1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Rep Power

    Xml Validation Help.

    Hey, I'm a complete noob at DTD and XML, and am attempting to code a published book into DTD and XML so it can be read electronically.

    However I'm getting some errors which I can't seem to get rid of, and researching them so far has got me nowhere.

    The errors relate to attributes and end tags:

    "cookbook" is not a member of a group specified for any attribute 47

    document type does not allow element "cookbook" here 47

    document type does not allow element "cookbook" here 48

    end tag for "method" which is not finished 161

    "cookbook" not finished but document ended 167

    end tag for "cookbook" omitted, but OMITTAG NO was specified 167

    "cookbook" not finished but document ended 167

    end tag for "cookbook" omitted, but OMITTAG NO was specified 167

    Here's the coding:
    xml Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE cookbook [ 
    <!ELEMENT cookbook (frontcover+,body+)>
    <!ELEMENT frontcover (title,byline,author)>
    <!ELEMENT title (#PCDATA)>
    <!ELEMENT byline (#PCDATA)>
    <!ELEMENT author (#PCDATA)>
    <!ELEMENT body (recipeone+,recipetwo+)>
    <!ELEMENT recipeone (recipe_title,prep_time,cook_time,recipe_blurb,ingredients_list,ingredient*,quantity*,food_item*,met  hod*)>
    <!ELEMENT recipetwo (recipe_title,prep_time,serves?,cook_time,recipe_blurb,ingredients_list,ingredient*,quantity*,food_i  tem*,method*)>
    <!ELEMENT recipe_title (#PCDATA)>
    <!ELEMENT prep_time (#PCDATA)>
    <!ELEMENT serves (#PCDATA)>
    <!ELEMENT cook_time (#PCDATA)>
    <!ELEMENT recipe_blurb (#PCDATA)>
    <!ELEMENT ingredients_list (ingredient+)>
    <!ELEMENT ingredient (#PCDATA|quantity|food_item)*>
    <!ELEMENT quantity (#PCDATA)>
    <!ELEMENT food_item (#PCDATA)>
    <!ELEMENT method (step_one,step_two,step_three,step_four,step_five,step_six,step_seven,step_eight,step_nine,step_ten,  step_eleven,step_twelve,step_thirteen,step_fourteen,step_fifteen,step_sixteen)*>
    <!ELEMENT step_one (#PCDATA)>
    <!ELEMENT step_two (#PCDATA)>
    <!ELEMENT step_three (#PCDATA)>
    <!ELEMENT step_four (#PCDATA)>
    <!ELEMENT step_five (#PCDATA)>
    <!ELEMENT step_six (#PCDATA)>
    <!ELEMENT step_seven (#PCDATA)>
    <!ELEMENT step_eight (#PCDATA)>
    <!ELEMENT step_nine (#PCDATA)>
    <!ELEMENT step_ten (#PCDATA)>
    <!ELEMENT step_eleven (#PCDATA)>
    <!ELEMENT step_twelve (#PCDATA)>
    <!ELEMENT step_thirteen (#PCDATA)>
    <!ELEMENT step_fourteen (#PCDATA)>
    <!ELEMENT step_fifteen (#PCDATA)>
    <!ELEMENT step_sixteen (#PCDATA)>
    <!ATTLIST cookbook photographer CDATA #IMPLIED>
    <!ATTLIST cookbook illustrator CDATA #IMPLIED>
    <!ATTLIST cookbook edition CDATA #IMPLIED>
    <!ENTITY PUBLISHER "Quadrille Publishing">
    <!ENTITY COPYRIGHT "Copyright 2010 Quadrille Publishing">
    	<cookbook photographer="Emma Lee" cookbook illustrator="Ruth Jackson">
    		<cookbook edition= "1st"> 
    			<title> Alice's Cookbook </title>
    			<byline> "I love this book. I love everything about it: the recipes, the tone and, as importantly, Alice's warmth." </byline>
    			<author> Alice Hart </author>
    				<recipe_title> Honey's Raspberry Turnover </recipe_title>
    				<prep_time> Hands on Time: 15 mins </prep_time>
    				<cook_time> 20 mins </cook_time>
    				<recipe_blurb> Honey, my baker-extraordinaire, puff-pastry-making gradnmother, has been a dab hand with a turnover for 
    				as long as I can remember, churning out batches of apple, apricot or raspberry from a handsome blue Aga. Make sure you 
    				use all-butter puff pastry; it tastes better and has a much more wholesome ingredient list. </recipe_blurb>
    				<ingredient> flour, to dust </ingredient> 
    				<ingredient> <quantity> 500g </quantity> of <food_item>  all-butter puff pastry 
    				</food_item> </ingredient>
    				<ingredient> <quantity> 500g </quantity> of <food_item> fresh raspberries </food_item> 
    				<ingredient> <quantity> 125g </quantity> of <food_item> vanilla sugar or caster sugar
    				</food_item> </ingredient>			 		
    				<ingredient> <quantity> 1 </quantity> of <food_item> free-range egg yolk </food_item> 
    				mixed with <quantity> 1 tbsp </quantity> <food_item> milk </food_item> </ingredient>
    					<step_one> Flour surface. </step_one>
    					<step_two> Roll out pastry to form a 1/2 thick rectangle. </step_two>
    					<step_three> Straighten raggedy edges with a sharp knife. </step_three>
    					<step_four> Cut pastry into eight even squares of 15x15cm. </step_four>
    					<step_five> Place a pile of raspberries in each square, slightly off centre. 
    					<step_six> Add a heaped teaspoon of sugar. </step_six>
    					<step_seven> Using a pastrry brush, paint a little water around the edge and bring one 
    					corner to meet its diaganol opposite. </step_seven>
    			 		<step_eight> Press the edges together firmly to seal using the tines of a fork. 
    					<step_nine> Repeat to make eight pastries. </step_nine>
    					<step_ten> Place pastries on a baking tray. </step_ten>
    					<step_eleven> Preheat oven to 200 degrees/fan 190 degrees/gas mark 6. </step_eleven>
    					<step_twelve> Brush pastry with egg wash (yolk and milk mixture). </step_twelve>
    					<step_thirteen> Sprinkle with a little more sugar. </step_thirteen>
    					<step_fourteen> Cut a small vent in the top of each to let the steam out. 
    					<step_fifteen> Bake for 20 minutes, until exuberantly plump and golden. </step_fifteen>
    					<step_sixteen> Cool on a wire rack and serve warm. </step_sixteen>
    				<recipe_title> Melting Chocolate Cake </recipe_title>
    				<prep_time> Hands on Time: 20 mins </prep_time>
    				<serves> Serves 8 </serves>
    				<cook_time> 30-35 mins </cook_time>
    				<recipe_blurb> Ah, the wonder of fallen, sunken chocolate cakes. They're so rich but 
    				oh-so-good and only need a few ingredients. Basically, this is a sunful baked mousse, with 				
    				only a few ground almonds to take it into cake territory </recipe_blurb>
    				<ingredient> pinch of salt </ingredient>
    				<ingredient> <quantity> 150g </quantity> of <food_item>  alcubed unsalted butter, plus more
    				for the tin </food_item> </ingredient>
    				<ingredient> <quantity> 250g </quantity> of <food_item> good, dark chocolate 
    				(70% cocoa solids), broken into pieces </food_item> </ingredient>
    				<ingredient> <quantity> 150g </quantity> of <food_item> caster sugar </food_item> 
    				<ingredient> <quantity> 5 </quantity> of <food_item> free-range eggs, separated 
    				</food_item> </ingredient>
    				<ingredient> <quantity> 30g </quantity> of <food_item> ground almonds </food_item> 
    				<ingredient> <quantity> 1 tbsp </quantity> of <food_item> bourbon </food_item> 
    				<step_one> Lightly butter a 23 cm round, springform cake tin, then cut non-stick baking 
    				parchment to line the base and sides. </step_one>
    				<step_two> Heat the oven to 160 degrees/fan 150 degrees/gas mark 3. </step_two>
    				<step_three> Melt the chocolate and butter in a bain marie or in the microwave. 
    				<step_four> Allow to cool a little, then stir until smooth and add 60g of the suger and 1 
    				egg yolk. </step_four>
    				<step_five> Gardually mix in the remaining yolks. </step_five>
    				<step_six> Stir in the almonds and bourbon. </step_six>
    				<step_seven> Use electric beaters to whisk the egg whites with the salt until they hold 
    				soft peaks. </step_seven>
    				<step_eight> Gradually whisk in the remaining sugar, 2 tbsp a time, whisking until stiff 
    				and glossy. </step_eight>
    				<step_nine> Loosen the chocolate nmixture with a spoonful of egg white, then fold in the 
    				rest with a spatula or large spoon. </step_nine>
    				<step_ten> Pour the batter into the prepared tin, level the top and bake for 30-35 minutes 
    				<step_eleven> Leave the cake to cool in the tine, on a wire rack, for 15 minutes. 
    				<step_twelve> Remove the sides and leave to cool on the base of the tin. </step_twelve>
    				<step_thirteen> Eat! </step_thirteen>

    Last edited by requinix; May 3rd, 2013 at 12:49 PM. Reason: highlighting and line numbers
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Washington, USA
    Rep Power
    You have three <cookbook>s, nested together. As far as the DTD is concerned your XML should look more like
    xml Code:
    <cookbook photographer="Emma Lee" illustrator="Ruth Jackson" edition= "1st">

IMN logo majestic logo threadwatch logo seochat tools logo