示例#1
0
  public static void main(String[] args) {

    if (args.length <= 0) {
      System.out.println("Usage: java nu.xom.samples.PureValidator URL");
      return;
    }

    try {
      Builder parser = new Builder(true, new MinimalNodeFactory());
      parser.build(args[0]);
      System.out.println(args[0] + " is valid.");
    } catch (ValidityException ex) {
      System.out.println(args[0] + " is not valid.");
      System.out.println(ex.getMessage());
      System.out.println(" at line " + ex.getLineNumber() + ", column " + ex.getColumnNumber());
    } catch (ParsingException ex) {
      System.out.println(args[0] + " is not well-formed.");
      System.out.println(ex.getMessage());
      System.out.println(" at line " + ex.getLineNumber() + ", column " + ex.getColumnNumber());
    } catch (IOException ex) {
      System.out.println("Due to an IOException, the parser could not check " + args[0]);
    }
  }