| ||
1. | Which of these classes is an abstracted class?
|
|
2. | What is the difference between an object and a class?
|
|
3. | Whats wrong with this script? <HTML><BODY> var xmlDoc; xmlDoc = ActiveXObject("Microsoft.XMLDOM"); xmlDoc.load("customers.txt"); </BODY></HTML>
|
|
4. | Which of the following commands returns a Document class object? a. xmlDoc.getElementsByTagName("name"); b. xmlDoc.documentElement.childNodes.item(0); c. xmlDoc.documentElement; d. xmlDoc.getElementsByTagName("name").item(1).attributes(0).name e. xmlDoc.getElementsByTagName("name").item(1).attributes(0).name |
|
Answers
1. | Exercise 1 solution a. Node class. Many of the other classes in the XML DOM inherit both attributes and methods from the Node class. |
2. | Exercise 2 solution Choices b, c, and d are all true. A class defines structure and programmatic definition. One or more objects can be created from a single class making an object an iteration. Saying an object is a copy of a class is not strictly correct but it gets across the concept that the class and object are two different things. In a relational database a table could be a class, and the rows in the table the objects created against that class (the table), using the structure of the table as a blueprint from which to copy or duplicate from. |
3. | Exercise 3 solution b. Its loading a .txt file. The file loaded should be an XML file with an .xml extension, such as customers.xml, and not customers.txt. d. The keyword new is missing before ActiveXObject. The script should look something like this: <HTML><BODY> <SCRIPT LANGUAGE="JavaScript"> var xmlDoc; xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.load("customers.xml"); </SCRIPT> </BODY></HTML> |
4. | Exercise 4 solution a. returns an element. b. returns the first item in a collection. c. is the correct answer returning a Document class object. d. returns an attribute name. e. returns an attribute value. |
| ||