[School] Exercise specification DTD structure, XML Schema in

This article homework on the DTD specification structure and XMLSCHEMA within “Exercise” his, you can refer to.

Threads: For shares of 1 students include: Full Name, class, address, sex, date of birth and a transcript, Each record consists of tables: STT, Subject name, semester 1, semester 2, Average score for the whole year. Be specific contents and structure (according to the DTD or XMLSCHEMA) XML document corresponding to the score cards.

Award:
* Specifications content: It was written XML document containing the contents of the transcript on. Which can be used in reference specification DTD structure or XMLSCHEMA.
For information on our cards can be divided into 2 The main part of the report card is the student information (contains the name, class,…) and transcripts (contain their courses).

Noted: Because speech problems “according to the DTD or XMLSCHEMA” in all, then you should follow 1 in 2 what is the whiff DTD or XMLSCHEMA, I did both 2, choose which one you like, then choose.

<?xml version = "1.0" ?>

<!-- if you use dtd-->
<!DOCTYPE PhieuDiem SYSTEM "phieudiemhocsinh.dtd">
<!-- end use dtd-->

<!-- if you use schema-->
<PhieuDiem xmlns = "http://www.w3school.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "phieudiemhocsinh.xsd">
<!-- end use chema-->

<PhieuDiem>
	<SinhVien>
		<HoTen>Nguyen Van Quan</HoTen>
		<Lop>KTPMK10B</Lop>
		<DiaChi>Bac Ninh</DiaChi>
		<GioiTinh>Nam</GioiTinh>
		<NgaySinh>31/12/1992</NgaySinh>
	</SinhVien>
	
	<BangDiem>
		<MonHoc>
			<STT>1</STT>
			<TenMon>XML</TenMon>
			<DienKy1>10</DienKy1>
			<DienKy2>10</DienKy2>
			<DienTB>10</DienTB>
		</MonHoc>
		
		<MonHoc>
			<STT>2</STT>
			<TenMon>Java</TenMon>
			<DienKy1>10</DienKy1>
			<DienKy2>10</DienKy2>
			<DienTB>10</DienTB>
		</MonHoc>
	</BangDiem>
</PhieuDiem>

* Specification DTD structure corresponding

<?xml version="1.0"?>
<!DOCTYPE PhieuDiem[
	<!ELEMENT PhieuDiem(SinhVien, BangDiem)>
	
	<!ELEMENT SinhVien(HoTen, Lop, DiaChi, GioiTinh, NgaySinh)>
	<!ELEMENT BangDiem(MonHoc+)>
	
	<!ELEMENT HoTen(#PCDATA)>
	<!ELEMENT Lop(#PCDATA)>
	<!ELEMENT DiaChi(#PCDATA)>
	<!ELEMENT GioiTinh(#PCDATA)>
	<!ELEMENT NgaySinh(#PCDATA)>
	
	<!ELEMENT MonHoc(STT, TenMon, DiemKy1, DiemKy2, DiemTB)>
	<!ELEMENT STT(#PCDATA)>
	<!ELEMENT TenMon(#PCDATA)>
	<!ELEMENT DiemKy1(#PCDATA)>
	<!ELEMENT DiemKy2(#PCDATA)>
	<!ELEMENT DiemTB(#PCDATA)>
]>

* Specification structure corresponding XMLSCHEMA

<?xml version = "1.0"?>
<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
	<xs:element name = "PhieuDiem" type="KPhieuDiem"/>
	
	<xs:complexType name = "KPhieuDiem">
		<xs:sequence>
			<xs:element name = "SinhVien" type = "KSinhVien"/>
			<xs:element name = "BangDiem" type = "KBangDiem"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:complexType name = "KieuSinhVien">
		<xs:sequense>
			<xs:element name = "HoTen" type = "xs:string"/>
			<xs:element name = "Lop" type = "xs:string"/>
			<xs:element name = "DiaChi" type = "xs:string"/>
			<xs:element name = "GioiTinh">
				<xs:simpleType>
					<xs:restriction base = "xs:string"/>
					<xs:pattern value = "Nam|Nu"/>
				</xs:simpleType>
			</xs:element>
			<xs:element name = "NgaySinh" type = "xs:date"/>
		</xs:sequense>
	</xs:complexType>
	
	<xs:complexType name = "KBangDiem">
		<xs:element name = "MonHoc" type = "KMonHoc"/>
	</xs:complexType>
	
	<xs:complexType name = "KMonHoc">
		<xs:sequense>
			<xs:element name = "STT" type = "xs:integer"/>
			<xs:element name = "TenMon" type = "xs:string"/>
			<xs:element name = "DiemKy1" type = "KDiem"/>
			<xs:element name = "DiemKy2" type = "KDiem"/>
			<xs:element name = "DiemTB" type = "KDiem"/>
		</xs:sequense>
	</xs:complexType>
	
	<xs:simpleType name = "KDiem">
		<xs:restriction base = "xs:double"/>
		<xs:minExclusive value = "0.0"/>
		<xs:maxExclusive value = "10.0"/>
	</xs:simpleType>
</xs:schema>