Answer all questions. One hour and 20 minutes.
Return both questions and answers.
Name: _________________________________________ Grade: __________________
(1) [10 points] Write a Cold Fusion program
t2aq1.cfm to list all distinct values of a user-specified column for the
table s00t2q1 of the DSN temp. The table s00t2q1 has four columns,
EmployeeID being the primary key. An instance looks like:
EmployeeID | FullName | EMailAddress | Country |
1 | Kiu Shen | shen@lattes.uhcl.edu | China |
2 | Grace Shen | sheng@lattes.uhcl.edu | China |
3 | Bill Ho | ho@lattes.uhcl.edu | China |
4 | Lu Zhan | luz@lattes.uhcl.edu | India |
5 | Rama Modi | modi@lattes.uhcl.edu | India |
6 | Jiang Xu | xu@lattes.uhcl.edu | China |
7 | Matt Maloney | maloney@lattes.uhcl.edu | USA |
The column name should be supplied by using the parameter ColumnName in the query string of the URL. If the input URL is:
http:/yourserver/t2aq1.cfm?ColumnName=Country
the output should be:
If the input URL is:
http:/yourserver/t2aq1.cfm?ColumnName=FullName
the output should be:
If an user input an incorrect column name, a proper message is given. For the url:
http:/yourserver/t2aq1.cfm?ColumnName=xyz
the output should be:
(2) [5 points] Write a Javascript bookmarklet (a Javascript pseudo-url) to show the number of images in the current url page in an alert window. For example:
(3) [10 points] Consider the following html file t2aq3.html:
<form action="t2aq3.asp" method="post">
Enter XML string:
<br>
<textarea name="xml" cols="60" rows="14"></textarea>
<br>
<input type="submit">
</form>
which creates the following form to allow the user to input an XML document in a string:
The form is submitted to the Active Server Pages program t2aq3.asp which will show the number of top level children nodes:
The number of top level children nodes is 3 in this case because there are three article tags.
If the input is incorrect:
a proper message with the error line number and reason are given:
Write the program t2aq3.asp. You may use the methods 'line' and 'reason' of the interface IXMLDOMParseError.
(4) [5 points] Consider the following XML document.
<?xml version="1.0" ?>
<!DOCTYPE class PUBLIC "http://somewhere/class.dtd">
<class>
<title>CSCI 4230 software
Tools</title>
<instructor>K. Yue</instructor>
<student status="graduate">Mary
Simon</student>
<student>Paul Simon</student>
<student status="undergraduate">
<firstName>Robert</firstName>
<lastName>Wagner</lastName>
</student>
</class>
Give a minimal DTD for the document.