1

ヘルプ: 検証エラー: 要素 'ingred' はコンテンツ モデルに対して有効ではありません: '(frontmatter,ingred,prep,comment)' [xml]

誰かが私に欠けているものを教えてもらえますか?

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE lovefood [
<!ELEMENT lovefood (frontmatter,ingred,prep,comment)>
<!ELEMENT frontmatter (publisher,title,date,isbn,blurb)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT isbn (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>

<!ELEMENT ingred ((recipe|subrecipe)*)>
<!ATTLIST recipe title CDATA #IMPLIED>
<!ELEMENT recipe (section,ing*)>
<!ELEMENT section (#PCDATA)>
<!ATTLIST subrecipe title CDATA #IMPLIED>
<!ELEMENT subrecipe (ing*)>
<!ATTLIST ing name CDATA #REQUIRED
   amount CDATA #IMPLIED
    unit CDATA #IMPLIED>
<!ELEMENT ing (#PCDATA)>

<!ELEMENT prep (step+)>
<!ELEMENT step (#PCDATA)>

<!ELEMENT comment (photo_of_dish,pagenumber)>
<!ELEMENT photo_of_dish (#PCDATA)>
<!ELEMENT pagenumber (#PCDATA)>
]>

<lovefood>

<frontmatter>
<publisher>Parragon Books Ltd</publisher>
<title>Love Food</title>
<date>2011</date>
<isbn>978-1-4454-4285-3</isbn>
<blurb>Clear and easy-to-follow ingredients lists and step-by-step methods</blurb>
</frontmatter>

<ingred>
<recipe title="Ingredients">
<section>fish and seafood</section>
<ing name="plain flour, for dusting olive oil, for oiling and drizzling"></ing>
<ing name="quantity tomato sauce" amount="1"></ing>
<ing name="mixed fresh seafood" amount="225" unit="g"></ing>
<ing name="red pepper and yellow pepper deseeded and chopped" amount="0.5"></ing>
<ing name="capers, rinsed" amount="1" unit="tbsp"></ing>
<ing name="Taleggio cheese, grated" amount="55" unit="g"></ing>
<ing name="freshly grated parmesan cheese" amount="3" unit="tbsp"></ing>
<ing name="dried oregano" amount="0.5" unit="tsp"></ing>
<ing name="anchovy fillets in oil, drained and sliced" amount="75" unit="g"></ing>
<ing name="black olivees, stoned" amount="10"></ing>
<ing name="salt and pepper"></ing>
</recipe>
</ingred>

<ingred>
<subrecipe title="Pizza Dough">
<ing name="plain flour, plus extra for dusting" amount="225" unit="g"></ing>
<ing name="salt" amount="1" unit="tsp"></ing>
<ing name="easy blend dried yeast" amount="1" unit="tsp"></ing>
<ing name="olive oil" amount="1" unit="tbsp"></ing>
<ing name="lukewarm water" amount="90" unit="ml"></ing>
</subrecipe>
</ingred>

<prep>
<step>
1. To make the pizza dough, sift the flour and salt into a bowl and stir in the         yeast.Make a wheel in the centre and pour in the oil and water. Incorporate the dry ingredients into the liquid, using floured hands.
</step> 
<step>
2. Turn out the dough onto a lightly floured work surface and knead well for 5 minutes,until smooth and elastic. Return to the clean bowl, cover with lightly oiled clingfilm and set aside to rise in a warm place for about 1 hour, or until doubled in size.
</step>
<step>
3. Turn out the dough again onto a lightly floured work surface and knock down. Knead briefly, then roll out the dough into a circle about 6mm/ 1/4 inch thick. Transfer to a lightly oiled baking sheet and push up the edge with your fingers to form a small rim.
</step>
<step>
4. Spread the tomato sauce over the pizza base, almost to the edge.Arrange the mixed seafood, red and yellow peppers and capers evenly on top.
</step>
<step>
5. Sprinkle the cheeses and oregano evenly over the topping. Add the anchovy fillets and olives, drizzle with olive oil.Season to taste with salt and pepper.
</step> 
<step>
6. Bake in a preheated oven, 220 C/ 425 F/ Gas Mark 7, for 20-25 minutes, until the crust is crisp and the cheese has melted.Serve immediately.
</step>
</prep>

<comment>
<photo_of_dish>input photo here</photo_of_dish>
<pagenumber>130</pagenumber>
</comment>

<ingred>
<recipe title="Scallops with porcini and cream sauce">
<section>fish and seafood</section>
<ing name="dried porcini mushrooms" amount="25"></ing>
<ing name="hot water" amount="500" unit="ml"></ing>
<ing name="olive oil" amount="3" unit="tbsp"></ing>
<ing name="butter" amount="40" unit="g"></ing>
<ing name="sliced scallops" amount="350" unit="g"></ing>
<ing name="garlic cloves, very finely chopped" amount="2"></ing>
<ing name="lemon juice" amount="2" unit="tbsp"></ing>
<ing name="double cream" amount="250" unit="ml"></ing>
<ing name="dried fettuccine or papardelle" amount="350" unit="g"></ing>
<ing name="chopped fresh flat leaf parsley, to serve" amount="2" unit="tbsp"></ing>
<ing name="salt and pepper"></ing>
</recipe>
</ingred>

<prep>
<step>
1. Put the porcini and hot water in a bowl and soak for 20 minutes. Strain the mushrooms, reserving the soaking water, and chop roughly. Line a sieve with kitchen paper and strain the mushroom water into a bowl
</step>
<step>
2. Heat the oil and butter in a large frying pan over a medium heat. Add the scallops and cook for 2 minutes, or unitl just golden. Add the garlic and mushrooms, then stir-fry for another minute
</step>
<step>
3. Stir in the lemon juice, cream and 150ml of the mushroom water. Bring to the boil, then simmer over a medium heat for 2-3 minutes, stirring constantly, until the liquid is reduced by half. Season with salt and pepper. Remove from heat.
</step>
<step>
4. Meanwhile, bring a large saucepan of lightly salted water to the boil. Add the pasta, bring back to the boil and cook for 8-10 minutes, until tender but firm. Drain and transfer to a warm serving dish. Briefly reheat the sauce and pour over the pasta. Sprinkle with the parsley and toss well to mix. Serve immediately.
</step>
</prep>

<comment>
<photo_of_dish>input photo here</photo_of_dish>
<pagenumber>126</pagenumber>
</comment>
</lovefood>

要素 'ingred' はコンテンツ モデルには無効です: '(frontmatter,ingred,prep,comment)' [xml]

4

2 に答える 2

2

あなたのDTDは、ラブフードが正確な順序で正確に4人の子供を含まなければならないと指定しています:

<!ELEMENT lovefood (frontmatter,ingred,prep,comment)>

が複数ありingredます。これが必要な場合は、DTD を次のように変更できます。

<!ELEMENT lovefood (frontmatter,ingred+,prep,comment)>

[エラー メッセージの解釈が必ずしも容易ではないことに同意しますが、それは何が問題なのかを正確に判断するのが難しいためです。したがって、メッセージを使用して、問題が最初にどこにあるかを見つけてください]

于 2013-05-12T13:13:48.680 に答える
1

DTD によると、 のコンテンツ モデルlovefood(frontmatter, ingred, prep, comment)(それぞれ 1 つずつ、この順序で) です。XML コンテンツは、、、、 、、の直下の子を含むため、そのモデルに違反していますlovefoodfrontmatteringredingredprepcommentingredprepcomment.

そのため、修正する必要があります。実際に必要な構造を明確にせずに XML ドキュメントを貼り付けただけなので、正確な方法は明らかではありません。

少し奇妙に見えることの 1 つはingred、 の親として持つことですrecipe。逆にすると、より自然に思えます。レシピには材料のリストが含まれています。そして、これはレシピのコレクションのように見えるので、要素を子としてrecipes持つrecipe要素を提案して、のコンテンツ モデルlovefoodが単純になるようにします(frontmatter, recipes)

于 2013-05-12T17:17:10.517 に答える