Code example for InputSource

Methods: setByteStream

0
        private Document getDomElement(InputStream xmlStream) {
            Document doc = null;
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            try { 
                DocumentBuilder db = dbf.newDocumentBuilder();
                InputSource is = new InputSource();
                is.setByteStream(xmlStream);
                doc = db.parse(is);
            } catch (ParserConfigurationException e) {
                Log.e(TAG, e.getMessage());
                return null; 
            } catch (SAXException e) {
                Log.e("Error: ", e.getMessage());
                return null; 
            } catch (IOException e) {
                Log.e("Error: ", e.getMessage());
                return null; 
            } 
            return doc;
        } 
Contextual code suggestions in your IDE  Get Codota for Java