Code example for XMLReader

Methods: parsesetContentHandlersetFeature

        try { 
            SAXParserFactory parserFactory = SAXParserFactory.newInstance();
            SAXParser saxParser = parserFactory.newSAXParser();
            XMLReader reader = saxParser.getXMLReader();
            try { 
                // Do not load external DTDs (fix #8191) 
                reader.setFeature("", false);
            } catch (SAXException e) {
                // Exception very unlikely to happen, so no need to translate this 
                System.err.println("Cannot disable 'load-external-dtd' feature: "+e.getMessage());
            reader.parse(new InputSource(in));
            queueIterator = queue.iterator();
            return this;
        } catch (ParserConfigurationException e) {
            // This should never happen ;-) 
            throw new RuntimeException(e);
Contextual code suggestions in your IDE  Get Codota for Java