Example #1
0
 public void createQuestions(Element questions) {
   try {
     GaigsAV.questionCollection = QuestionFactory.questionCollectionFromXML(questions);
   } catch (QuestionParseException e) {
     System.out.println("ERROR: could not parse the questions.");
   }
 } // createQuestions(element)
Example #2
0
  private /*synchronized*/ void readQuestions(StringTokenizer st) throws VisualizerLoadException {
    String tmpStr =
        "STARTQUESTIONS\n"; // When CG's QuestionFactory parses from a string, it looks for
    // a line with STARTQUESTIONS -- hence we add it artificially here
    try { // Build the string for the QuestionFactory
      while (st.hasMoreTokens()) {
        tmpStr += st.nextToken() + "\n";
      }
    } catch (Exception e) {
      e.printStackTrace();
      throw new VisualizerLoadException("Ooof!  bad question format");
    }

    try {
      // System.out.println(tmpStr);
      // Problem -- must make this be line oriented
      GaigsAV.questionCollection = QuestionFactory.parseScript(tmpStr);
    } catch (QuestionParseException e) {
      e.printStackTrace();
      System.out.println("Error parsing questions.");
      throw new VisualizerLoadException("Ooof!  bad question format");
      // throw new IOException();
    }
  } // readQuestions(st)