private static void handleRestRequest ( String url , DefaultHandler handler ) throws SAXException , IOException , ParserConfigurationException { // Fetch XML stream URL u = new URL ( url ) ; InputStream response = URLConnectionTools . getInputStream ( u ) ; InputSource xml = new InputSource ( response ) ; // Parse XML SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; SAXParser saxParser = factory . newSAXParser ( ) ; saxParser . parse ( xml , handler ) ; }
Handles fetching and processing REST requests . The actual XML parsing is handled by the handler which is also in charge of storing interesting data .