CIT 597 Quiz 5: SAX and Perl
Fall 2008, David Matuszek Name_________________________________________
  1. (10 points) What two advantages does SAX have over DOM?

  2. (10 points) SAX calls your characters method with what three pieces of information?

  3. (10 points) Under what circumstances does SAX ignore whitespace?

  4. (60 points) Write a regular expression that will match each of the following (and nothing else!):

    1. A sequence of one or more digits. (Hint: \d matches one digit.)

    2. A hyphenated ten-digit phone number, such as 215-898-8122.

    3. A 16-digit credit card number, such as 1234 5678 9012 3456, where the space between each four-digit group is optional. (Use an underscore, _, to represent a space.)

    4. A complete word that does not contain one of the five vowels (aeiou).

    5. The two characters that start a C (C++, Java) comment, either // or /*.

    6. The complete string being tested, if and only if it contains a double letter pair (such as oo or TT). You can assume the string does not contain newlines.

  5. (10 points) Write a Perl statement to terminate the program with an error message if the variable $fileName contains a space.