2013-05-12 3 views
1

HELP : 유효성 검증 오류 : 요소 'ingred은'콘텐츠 모델이 유효하지 않습니다 '(frontmatter, ingred, 준비, 코멘트)'[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, 준비, 코멘트)'[XML]

답변

1

lovefood의 콘텐츠 모델은 각 순서대로 하나씩 (frontmatter, ingred, prep, comment)입니다. frontmatteringred, ingred, prep, comment, ingred, prep, comment.

그래서 수정해야합니다 : 그것은 lovefood의 다음 즉시 아이를 포함하고 있기 때문에 XML 내용은 해당 모델을 위반하는 것입니다. 당신이 실제로 원하는 구조를 명확히하지 않고 XML 문서를 붙여 넣었으므로 정확히 어떻게 명확하지 않은가.

한 가지 이상한 점은 ingredrecipe의 부모로 갖는 것입니다. 다른 방법으로하면 자연스러운 것처럼 보입니다. 레시피에는 재료가 들어있는 경우 목록이 포함되어 있습니다. 그리고 이것이 조리법 모음 인 것으로 보이므로 recipe 요소가있는 recipes 요소를 자식으로 제안하므로 lovefood의 내용 모델은 (frontmatter, recipes)이됩니다.

2

당신의 DTD가 lovefood 정확한 순서대로 정확히 네 자녀를 포함해야 함을 지정합니다 :

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

ingred이 두 개 이상 있습니다. 이것은 당신이 당신이 DTD를 변경할 수 있습니다 원하는 경우 :

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

[I 오류 메시지가 항상 쉽게 해석 할 수없는 것에 동의하지만, 정확히 어떤 문제가 결정하기 어렵 기 때문에 즉. 따라서 메시지를 사용하여 문제가있는 곳을 찾으십시오.