W10 Lesson 8 - Document Type Definition - Module
W10 Lesson 8 - Document Type Definition - Module
1
Document Type Definition
Course Module
[
declaration
]>
<!DOCTYPE letter [
]>
This means that the root tag of our XML document should be the element/tag
<letter>.
The next line:
means that inside the tag/element <letter> the XML document is required
to have the elements/tag <from>, <to>, and, <message>. If one of these
elements is missing, then your XML will produce an error. You can also notice
the + next to the to element/tag. This means that there could be one or
more <to> element inside <letter>.
The lines:
Refer to the body of the DTD. In these lines, the elements/tags <from>, <to>,
and, <message> have the type #PCDATA. #PCDATA means parse-able text
data.
Course Module
In order to be considered a valid XML document, the XML file should abide by
the rules set by the DTD. You can check if it is a valid XML document by using
an XML Validator.
Glossary
XML DTD: is a set of rules used to describe XML language accurately.
Course Module