Zoo tutorials: [ SQL | Linux | XML ]

A Gentle Introduction to xml

ATTLIST #REQUIRED, #IMPLIED, defaults and enumerated types
With answers

ATTLIST #REQUIRED, #IMPLIED, defaults and enumerated types

The following may occur in the ATTLIST tag:

#REQUIRED
A value must be given. It may not be the empty string.
#IMPLIED
No value need be given.
Enumerated type
A bracketed list, separated by | may be given.
Default
A quoted value may be given as the default value. The validator will insert the default if it is missing.

Rules to be enforced

Change the dtd so that the xml on the left passes validation and the xml on the right fails validation.


ValidInvalid
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE country SYSTEM "country.dtd">
<country 
   name         = "United Kingdom"
   constitution = "monarchy"
   population   = "58m"
/>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE country SYSTEM "country.dtd">
<country
   name         = "United Kingdom"
   constitution = "democracy"
   population   = "58m"
/>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE country SYSTEM "country.dtd">
<country
   name         = "Rockall"
   constitution = "other"
/>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE country SYSTEM "country.dtd">
<country
   name         = "United Kingdom"
   population   = "58m"
/>