Code example for InputSource

Methods: setCharacterStream

0
            final SAXParserFactory factory = SAXParserFactory.newInstance();
            try { 
                final SAXParser sp = factory.newSAXParser();
                final XMLReader xr = sp.getXMLReader();
 
                final InputSource is = new InputSource();
                is.setCharacterStream(new StringReader(xml));
 
                //we set the SAX DefaultHandler 
                xr.setContentHandler((DefaultHandler) mHandler);
 
                Out.v(TAG, "start parsing SAX");
 
                xr.parse(is);
 
                Out.v(TAG, "end parsing SAX");
 
            } catch (final Exception e) {
                e.printStackTrace();
                throw new ParseException("Parsing error");
Stop searching for code, let great code find you!  Add Codota to your java IDE