try { Builder parser = new Builder(); Document doc = parser.build(url); System.out.println(doc.toXML()); } catch (ParsingException ex) { System.out.println(url + " is not well-formed."); System.out.println(ex.getMessage()); } catch (IOException ex) { System.out.println("Due to an IOException, " + "the parser could not check " + args[0]); }