CIT 597 Quiz 7: RELAX NG, Ajax, Servlets
Fall 2008, David Matuszek Name_________________________________________
  1. (10 points) List two advantages of RELAX NG over DTDs.
    Uses XML syntax (hence, don't need a second parser)
    Is relatively easy to read and understand
    Can: interleave elements, specify data types, allow specific values; control mixed content

  2. (10 points) A RELAX NG schema can use either of two root elements. Name both of them.
    element, grammar

  3. (5 points) When writing an Ajax application, what is the significance of request.readystate having a value of 4?
    Indicates the response has been received.

  4. (5 points) What is the proper capitalization of xmlhttprequest?
    XMLHttpRequest
  5. (15 points) If you have an Ajax application that works the first time, but nothing appears to happen after that,
    1. What is the most likely explanation?
      You used a GET, and the first response was cached.

    2. What is the best way to fix the problem?
      Append some time or random value to the URL
      Not as good: Use POST

    3. Does this problem occur with GET, with POST, or with both? Tell why.
      Only with GET; POST requests are not cached by the browser.

  6. (5 points) The Ajax command  request.send(null); doesn't appear to send any information, so when would you use it?
    When you are using GET and the information is in the URL

  7. (5 points) Is the escape method used primarily with GET or with POST? Why?
    With GET, because many characters are illegal in a URL. The same characters are legal in the body of a POST.

  8. (5 points) What difference does the server see between an Ajax request and a non-Ajax request?   No difference.

  9. (10 points) Tell one advantage and one disadvantage of using innerHTML.
    Advantage: Easy
    Disadvantages: nonstandard (Microsoft specific), unreliable, and deprecated


  10. (5 points) If the server responds with XML, to what string should it set the mime type?   text/xml

  11. (10 points) Complete the following Java statement:
         Preferences userPrefs = Preferences.userNodeForPackage(MyProgram.class);

  12. (15 points) In the statement   x = userPrefs.get(y, z);   briefly tell the type and meaning of each of x, y, and z.
    Both are Strings. The first is the key, the second a default value to use if the key is not found.