Is my understanding of DTD correct?

683952

New Member
I am self-learning XML and here is the first DTD I wrote. Below is the XML data followed by the DTD. \[code\]<?xml version="1.0" encoding="unicode" ?><!DOCTYPE people SYSTEM "validator.dtd"><people> <student> <name>John</name> <course>Computer Technology</course> <semester>6</semester> <scheme>E</scheme> </student> <student> <name>Foo</name> <course>Industrial Electronics</course> <semester>6</semester> <scheme>E</scheme> </student></people> \[/code\]and the DTD \[code\]<!ELEMENT people (student)*><!ELEMENT student (name,course,semester,scheme)><!ELEMENT name (#PCDATA)><!ELEMENT course (#PCDATA)><!ELEMENT semester (#PCDATA)><!ELEMENT scheme (#PCDATA)> \[/code\]Here is my understanding of the DTD so far.
I have a root named \[code\]people\[/code\] that has \[code\]student\[/code\] inside of it. Now, since I have a \[code\]*\[/code\] then I can have \[code\]zero or more\[/code\] of students inside. But I guess it should be changed to \[code\]+\[/code\] (one or more) because it makes more sense ? Inside \[code\]student\[/code\] is name, course semester and scheme. When I leave out any symbols after the closing parentheses then it means that each of these tags can appear only once inside the student tag. This means a student can not have more than one name, more than one semester, etc Finally, name, course, semester and scheme have \[code\]#PCDATA\[/code\] which means data is going to be parsed by someone else and does excluding the symbol here make a difference?
 
Top