Name______________________________________ Last four digits Student Number___________________
<XML id="xml_data_island"> <greet> <word>< <letter><val>H</val><v>50</v><h>10</h></letter> <letter><val>A</val><v>50</v><h>60</h></letter> <letter><val>P</val><v>50</v><h>11060</h></letter> <letter><val>P</val><v>50</v><h>160</h></letter> <letter><val>Y</val><v>50</v><h>210</h></letter> </word>< <word>< <letter><val>H</val><v>100</v><h>10</h></letter> <letter><val>O</val><v>100</v><h>60</h></letter> <letter><val>L</val><v>100</v><h>110</h></letter> <letter><val>I</val><v>100</v><h>160</h></letter> <letter><val>D</val><v>100</v><h>210</h></letter> <letter><val>A</val><v>100</v><h>260</h></letter> <letter><val>Y</val><v>100</v><h>310</h></letter> </word>< </greet> </XML> | 2. (50 points) An XML file is transfered within an HTML file inside a data island named "xml_data_island" (shown at the left). Its DTD is shown below: <?xml version="1.0"?> <!DOCTYPE greet [ <!ELEMENT greet (word+)> <!ELEMENT word (letter+)> <!ELEMENT letter (val,v,h) > <!ELEMENT val (#PCDATA) > <!ELEMENT v (#PCDATA) > <!ELEMENT h (#PCDATA) > ]> Write a Vbscript sub named p2 that when called parses the XML data and extracts three values from each "letter" node: (1) val (the value a single character); (2) v (the vertical distance from the top of the page); and (3) h (the horizontal distance from the left side of the page). A gif file for each letter is available (named: charA.gif; charB.gif; charC.gif; ...; charZ.gif). The sub p2 then creates a new page on-the-fly that displays the sequence of gif files that correspond to the val sequence retrieved from the XML tree. Use the values of v and h for each val to assign the Top and Left properties of absolute positioned images. Show only the VBScript for p2. TRY IT HERE |