xml - DTD Element Assistance -
this question has answer here:
- external referenced dtd in xml 1 answer
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?
if write file .xml have no error generated, if have .dtd file must clear element! correct file test.xml:
<?xml version="1.0" encoding="utf-8"?> <!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">]> <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> <discount></discount> </price> </book> </catalog> correct file test.dtd (linked xml file declaration same test.xml ):
<?xml version="1.0" encoding="utf-8"?> <!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">
Comments
Post a Comment