cs57108fa-midsec2

cs57108fa-midsec2 - Computer Science 571 MidTerm Section 2...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Computer Science 571 MidTerm Section 2 - Prof. Papa Thursday, October 9, 2008, 7:00pm – 8:10pm Name: Social Security or Student Id Number: 1. This is a closed book exam. 2. Please answer all questions. 3. Place all answers on the exam and return the entire exam DOM QUESTIONS [30 PTS] Consider a DOM program, with the user interface as displayed in Figure 1. Figure 1. The DOM program processes XML files, such as the following class.xml file: <Course> <CourseName>CSCI-571</CourseName> <Session> <SessionNumber>1</SessionNumber> <Instructor>Steve </Instructor> <Students> <Student> <StudentName>Brad</StudentName> <StudentFinalGrade>A</StudentFinalGrade> </Student>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 <Student> <StudentName>Peter</StudentName> <StudentFinalGrade>A</StudentFinalGrade> </Student> <Student> <StudentName>George</StudentName> <StudentFinalGrade>B</StudentFinalGrade> </Student> </Students> </Session> <Session> <SessionNumber>2</SessionNumber> <Instructor>Peter</Instructor> <Students> <Student> <StudentName>petrus</StudentName> <StudentFinalGrade>B</StudentFinalGrade> </Student> <Student> <StudentName>john</StudentName> <StudentFinalGrade>A</StudentFinalGrade> </Student> <Student> <StudentName>mark</StudentName> <StudentFinalGrade>C</StudentFinalGrade> </Student> <Student> <StudentName>Daniel</StudentName> <StudentFinalGrade>C</StudentFinalGrade> </Student> </Students> </Session> </Course> The program traverses the XML file using DOM APIs and produces an HTML file of statistics, calculating the total number of students and the number of students in each session, and producing the output shown in Figure 2 below.
Background image of page 2
3 Figure 2. The following program implements such functionality. The program manipulates the XML file as follows: (1) it inserts an element “TotalNumberOf Students” with the appropriate calculated value, before the first session and (2) it inserts an element “NumberOfStudents” with the appropriate calculated value, before each student element, for each session. The program then navigates the resulting XML, and outputs HTML as shown in figure 2. Some of the code has been removed. Your task is to restore the
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/12/2011 for the course CSCI 571 taught by Professor Papa during the Fall '07 term at USC.

Page1 / 9

cs57108fa-midsec2 - Computer Science 571 MidTerm Section 2...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online