xsd - XML Validation of DTD Elements -
hey guys i've got xml dtd code external when try , validate it, seem error. code have below:
<!doctype catalog [ <!element catalog (book)+> <!element book (title, authors, year_published, isbn, number_of_pages, price) > <!element title (#pcdata)> <!element authors (author)> <!element author (first_name, last_name, gender)> <!element first_name (#pcdata)> <!element last_name (#pcdata)> <!element gender (#pcdata)> <!element year_pusblished (#pcdata)> <!element isbn (#pcdata)> <!element number_of_pages (#pcdata)> <!element price (discount)> <!attlist price discount (yes|no) "no">]>
i know correct when validate error message comes up:
"markup declarations contained in or pointed document type declaration must well-formed. line 3 column 4"
i've checked can't seem working. guys able help?
you seem have used http://www.validome.org/xml/validate/ tool, issues exact error message in question , isn’t particularly helpful in other ways either. generally, quality of free xml validators is... varying. better tool http://xmlvalidator.new-studio.org.
if append following simple xml element , validate using better tool, better idea of problems:
<catalog> <book> <title></title> <authors> <author> <first_name></first_name> <last_name></last_name> <gender></gender> </author> </authors> <year_published></year_published> <isbn></isbn> <number_of_pages></number_of_pages> <price></price> </book> </catalog>
you following error messages:
line 25 column 17 : element type "year_published" must declared.
line 28 column 16 : content of element type "price" incomplete, must match "(discount)".
the first error easy: fix spelling year_pusblished
(removing first s
) in element declaration.
the second 1 less obvious, simple: have declared price
element (discount)
content model. mean price
element must contain discount
element , nothing more, , make no sense (though possible, formally speaking, need declare element discount
). want allow character data content (the applicability of discount specified in discount
attribute):
<!element price (#pcdata)>
Comments
Post a Comment