100% found this document useful (1 vote)
80 views2 pages

Tutorial 3 - XML - DTD - XML Parser

This document contains exercises on XML and DTD (Document Type Definition). The first exercise asks the reader to identify which tag names are valid and which are not. The second exercise asks the reader to check if a provided XML document is well-formed, and make minimal changes if needed. The third exercise asks the reader to write a DTD for a given XML document. The second part provides a movie data table and asks the reader to create an XML file to store the data, and then parse the XML file using PHP or Java to display movies published before 2010 and movies with a rating greater than 8.

Uploaded by

Tủ Lạnh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
80 views2 pages

Tutorial 3 - XML - DTD - XML Parser

This document contains exercises on XML and DTD (Document Type Definition). The first exercise asks the reader to identify which tag names are valid and which are not. The second exercise asks the reader to check if a provided XML document is well-formed, and make minimal changes if needed. The third exercise asks the reader to write a DTD for a given XML document. The second part provides a movie data table and asks the reader to create an XML file to store the data, and then parse the XML file using PHP or Java to display movies published before 2010 and movies with a rating greater than 8.

Uploaded by

Tủ Lạnh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Part 1: XML and DTD

Exercise 1: Which of the following Tags names are valid, which are not? Explain your
answers.
 <lecture>
 <student and teacher>
 <student&teacher>
 <DilbertComicStrip>
 <XMLisFun>
 <4u>
 <student.and.teacher>
 <>

Exercise 2: The following XML document describes some entries of a library


<library>
<book id=2003-Blanken>
<title>Intelligent XML Search</title>
<editor>Henk A. Blanken et al.</editor>
<publisher>Springer Verlag</PUBLISHER>
</book>
<journal id="TODS_1_2003 publ_year="2003">
<title>ACM Transactions on Databases</title>
<volume>24<number>1</number></volume>
</journal>
<misc id="Dipl2002-12" id="TR2002-01-04">
<author>U. Known</author>
<title>The Diploma Thesis that didn’t appear
<year>2002</year>
<pages>0</pages>
</misc>
</library>
Check if the XML document is well-formed. If it is not, change it so that it becomes well-
formed, making as little changes as possible.
Exercise 3: Write DTD for the following XML:
<address>
<name>
<first>Tran</first>
<last>Khoa</last>
</name>
<email>[email protected]</email>
<phone>0917741703</phone>
<birthday>
<year>2000</year>
<month>November</month>
<day>16</day>
</birthday>
</address>

Part 2: XML Parser


XAMPP Download Link:
https://drive.google.com/file/d/1IjXr8ufGmSqqaf_WKUS4bUaYvgoWSbYR/view?
usp=sharing
Given this data table:
Movie Year Rating
Our Beloved Summer 2021 8.8
Skyfall 2012 7.8
Titanic 1997 7.8
Cloudy with a Chance of Meatballs 2009 6.9
Despicable Me 2010 7.6

1. Create an XML file movie.xml to store the data above.


2. Parse the XML file using PHP or Java and display:
a. Movie titles published before 2010
b. Movie titles have rating greater than 8

You might also like