コード例 #1
0
  /**
   * start the parsing
   *
   * @param file to parse
   * @return Vector containing the test cases
   */
  public XMLcpimParser() {
    try {
      SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
      saxParser = saxParserFactory.newSAXParser().getXMLReader();
      saxParser.setContentHandler(this);
      saxParser.setFeature("http://xml.org/sax/features/validation", true);
      // parse the xml specification for the event tags.

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  /**
   * start the parsing
   *
   * @param file to parse
   * @return Vector containing the test cases
   */
  public XMLcpimParser(String fileLocation) {
    try {
      SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
      saxParser = saxParserFactory.newSAXParser().getXMLReader();
      saxParser.setContentHandler(this);
      saxParser.setFeature("http://xml.org/sax/features/validation", true);
      // parse the xml specification for the event tags.
      saxParser.parse(fileLocation);

    } catch (SAXParseException spe) {
      spe.printStackTrace();
    } catch (SAXException sxe) {
      sxe.printStackTrace();
    } catch (IOException ioe) {
      // I/O error
      ioe.printStackTrace();
    } catch (Exception pce) {
      // Parser with specified options can't be built
      pce.printStackTrace();
    }
  }