
144 • XML & Related Technologies
XML schema (student.xsd)
<?xml version = “1.0” ?>
<xsd:schema xmlns:xsd = “http://www.w3org/2001/XMLSchema”>
<xsd:element name = “STUDENT” type = “xsd:string”/>
</xsd:schema>
Exercise 2
Write the same XML document, but this time use a DTD.
Solution
XML document (student.xml)
<?xml version=”1.0”?>
<!DOCTYPE STUDENT SYSTEM “student.dtd”>
<STUDENT>
S Ramachandran
</STUDENT>
DTD (student.dtd)
<!ELEMENT STUDENT (#PCDATA)>
4.2 COMPLEX TYPES
4.2.1 Basics of Simple and Complex Types
Elements in schema can be divided into two categories: simple and complex. This is shown in Figure 4.5.
Elements in XML schema
Simple elements Complex ...