public static void main(String[] args) throws Exception { // final Logger log = Logger.getLogger(sample.class.getCanonicalName()); JobData jd = new JobData(); Scanner input = new Scanner(System.in); try { System.out.print("What is your user name? "); jd.setUsername(input.next()); System.out.print("What is your password? "); jd.setPassword(input.next()); } catch (Exception e) { // log.log(Level. SEVERE, "The system encountered an exception while attempting to login"); } finally { input.close(); } jd.setJob("TestREST"); jd.setServer("http://10.94.0.137"); jd.setPort("8006"); URL url = new URL("http://10.94.0.137:8006/api/xml"); Document dom = new SAXReader().read(url); for (Element job : (List<Element>) dom.getRootElement().elements("job")) { System.out.println( String.format( "Job %s with URL %s has status %s", job.elementText("name"), job.elementText("url"), job.elementText("color"))); } }