cs57109fa-midsec1-V2

Cs57109fa-midsec1-V2 - Computer Science 571 MidTerm Section 1 Prof Horowitz Thursday October 8 2008 9:30am 10:45am Name Social Security or Student

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 1 - Prof. Horowitz Thursday, October 8, 2008, 9:30am – 10:45am 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 Question 1 [20 pts] XML and JavaScript given the XML file <note> <to>Samuel</to> <from>Richard</from> <heading>Reminder</heading> <body>We meet tomorrow at 9:00AM</body> </note> The following web page produces the output shown immediately afterwards. Fill in the missing lines denoted by XXXXXXXXXX’s. <html> <body> <script type="text/javascript"> var xmlDoc; if (XXXXXXXXXXXXXXXXXXXXXX) { xmlDoc=XXXXXXXXXXXXXXXXXXXX } else if (XXXXXXXXXXXXXXXXXXXXXXXXXX) {xmlDoc=XXXXXXXXXXXXXXXXXXXXXXXXXXXX } else {alert('Your browser cannot handle this script'); }
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 xmlDoc.async=false; xmlDoc.load("note.xml"); var x=xmlDoc.documentElement.childNodes; for (var i=0;i<x.length;i++) { if (XXXXXXXXXXXXXXXX) { document.write(XXXXXXXXXXXXXXXX); document.write(XXXXXXXXXXXXXXXX); document.write("<br />"); } } </script></body></html> Output to: Samuel from: Richard heading: Reminder body: We meet tomorrow at 9:00AM Question 2 [20 pts] XML and JavaScript Given the same input file as above, The following web page produces the output shown immediately afterwards. Assume that the file is loaded in the same way as Question#1. Fill in the missing lines denoted by XXXXXXXs. <html> <head> <script type="text/javascript"> //Assume the file is loaded the same way //as question #1 above </script></head><body> <h1>XML and JavaScript</h1> <p><b>To:</b> <span id="to"></span><br /> <b>From:</b> <span id="from"></span><br /> <b>Message:</b> <span id="message"></span> <script type="text/javascript"> xmlDoc=loadXMLDoc("note.xml"); XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Background image of page 2
3 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX </script></body></html> Output To: Samuel From: Richard Message: We meet tomorrow at 9:00AM Question 3 [20 pts] XML and JavaScript INPUT XML FILE <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>Greatest Hits</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> <CD> <TITLE>Still got the blues</TITLE> <ARTIST>Gary Moore</ARTIST>
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 / 10

Cs57109fa-midsec1-V2 - Computer Science 571 MidTerm Section 1 Prof Horowitz Thursday October 8 2008 9:30am 10:45am Name Social Security or Student

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