PPT Slide
- If it is decided that a DTD will be necessary, then firstly the xml declaration standalone tag needs to be set to “no” and a doctype definition tag added to declare the name of the DTD file :
<?xml version=“1.0 standalone=“no” encoding=“UTF-8”?>
<!DOCTYPE Catalogue SYSTEM "book.dtd">
- ‘Catalogue’ is the name of the type of document contained in this file, ‘SYSTEM’ tells the processor to look for the private DTD at the following location and “book.dtd” is the name of the actual file.
- The root element must then be entered, under which all other elements are grouped.
- All the basic rules then apply :
- Do what the dtd instructs (these are developer-defined rules)
- Watch your capitalization - XML is case sensitive
- Quote attribute values eg. <AUTHOR dob=“1802” dod=“1885”>B. Johnson</AUTHOR>
- Close all tags - <AUTHOR> xxxxxxxx </AUTHOR> including empty tags (where nothing is defined)
- No overlapping markup :
<book> … <chapter> ... </chapter> … </book> correct
<book> … <chapter> ... </book> … </chapter> incorrect
- One single root element is allowed
- No isolated markup characters
- There are of course further rules but these define the basic building blocks of an XML document.