1. (50 points) An XML file shown to the left organizes the kings and queens of England into their royal families; provides their names; and years of their reign. The DTD is shown at the top and a portion of the XML is shown (just the beginning and end with lots left out). When the "GO" button is clicked, a javascript function named
p1is executed. This function produces a two column table that shows:
- a row for each "royal family name" in bold that spans two columns, followed by
- a row for each monarch with the "name" in the first column and the years of their "reign" in the second column
- this format is repeated for each "royalfamily"
- show the count of monarchs and royal families at the end of the table (as shown below)
- place the resulting table (stored as a string) in the DIV block with id="kings"
A portion of the output table is shown below:
HOUSE OF WESSEX | Egbert | 802-839 | Aethelbald | 855-860 | Aethelbert | 860-866 | Aethelred | 866-871 | Alfred the Great | 871-899 | ...lotsa lines omitted... | SAXE-COBURG-GOTHA | Edward VII | 1901-1910 | WINDSOR | George V | 1910-1936 | Edward VIII | 1936-1936 | George VI | 1936-1952 | Elizabeth II | 1952 - present |
TOTALS |
Monarchs | 65 |
Royal Families | 14 |
| NOTES:
The number of royal familes is: 0 to root.childNodes.length (range of outside i loop)
The royal family names are: root.childNodes(i).childNodes(0).text
The range of monarchs is from: 1 to root.childNodes(i).childNodes.length (range of inside j loop)
The king or queen names are: root.childNodes(i).childNodes(j).childNodes(0).text
The reigns are: root.childNodes(i).childNodes(j).childNodes(1).text
Shown NO HTML. Show only the javascript for p1.
|