Listing 4. The Vehicle-Definition Section of the DTD for the Traffic Jam Configuration File
<!ELEMENT vehicles ((vehicle)+,colors)>
<!ATTLIST vehicles numtypes NMTOKEN #REQUIRED>
<!ELEMENT vehicle EMPTY>
<!ATTLIST vehicle length NMTOKEN #REQUIRED
maxspeed NMTOKEN #REQUIRED
accel NMTOKEN #REQUIRED
slowdistance NMTOKEN #REQUIRED
stopdistance NMTOKEN #REQUIRED
>
<!ELEMENT colors (color)+>
<!ATTLIST colors num NMTOKEN #REQUIRED>
<!ELEMENT color EMPTY>
<!ATTLIST color red NMTOKEN #REQUIRED
green NMTOKEN #REQUIRED
blue NMTOKEN #REQUIRED
>
Copyright © 1994 - 2019 Linux Journal. All rights reserved.