import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import java.net.URL; public class Test { public static void main(String[] args) { try { URL url = new URL("http://query.yahooapis.com/v1/public/yql?format=xml" + "&q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDEUR%22,%20%22USDUAH%22)" + "&env=store://datatables.org/alltableswithkeys"); JAXBContext jaxbContext = JAXBContext.newInstance(Query.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Query query = (Query) unmarshaller.unmarshal(url.openStream()); System.out.println(query.results.toString()); } catch (Exception e) { e.printStackTrace(); } } }