dependency-check-core/src/main/java/org/owasp/dependencycheck/xml/hints/HintParser.java
/**
     * Parses the given XML stream and returns a list of the hint rules
     * contained.
     *
     * @param inputStream an InputStream containing hint rules
     * @param schema the XSD to use to validate the XML against
     * @return a list of hint rules
     * @throws HintParseException thrown if the XML cannot be parsed
     * @throws SAXException thrown if the XML cannot be parsed
     */
Parses the given XML stream and returns a list of the hint rules
contained.


Parses the given XML stream and returns a list of the hint rules contained .
private Hints parseHints(InputStream inputStream, String schema) throws HintParseException, SAXException {
        try (InputStream schemaStream = FileUtils.getResourceAsStream(schema)) {
            final HintHandler handler = new HintHandler();
            final SAXParser saxParser = XmlUtils.buildSecureSaxParser(schemaStream);
            final XMLReader xmlReader = saxParser.getXMLReader();
            xmlReader.setErrorHandler(new HintErrorHandler());
            xmlReader.setContentHandler(handler);
            try (Reader reader = new InputStreamReader(inputStream, "UTF-8")) {
                final InputSource in = new InputSource(reader);
                xmlReader.parse(in);
                final Hints hints = new Hints();
                hints.setHintRules(handler.getHintRules());
                hints.setVendorDuplicatingHintRules(handler.getVendorDuplicatingHintRules());
                return hints;
            }
        } catch (ParserConfigurationException | FileNotFoundException ex) {
            LOGGER.debug("", ex);
            throw new HintParseException(ex);
        } catch (SAXException ex) {
            if (ex.getMessage().contains("Cannot find the declaration of element 'hints'.")) {
                throw ex;
            } else {
                LOGGER.debug("", ex);
                throw new HintParseException(ex);
            }
        } catch (IOException ex) {
            LOGGER.debug("", ex);
            throw new HintParseException(ex);
        }
    }
private Hints parseHints ( InputStream inputStream , String schema ) throws HintParseException , SAXException { try ( InputStream schemaStream = FileUtils . getResourceAsStream ( schema ) ) { final HintHandler handler = new HintHandler ( ) ; final SAXParser saxParser = XmlUtils . buildSecureSaxParser ( schemaStream ) ; final XMLReader xmlReader = saxParser . getXMLReader ( ) ; xmlReader . setErrorHandler ( new HintErrorHandler ( ) ) ; xmlReader . setContentHandler ( handler ) ; try ( Reader reader = new InputStreamReader ( inputStream , "UTF-8" ) ) { final InputSource in = new InputSource ( reader ) ; xmlReader . parse ( in ) ; final Hints hints = new Hints ( ) ; hints . setHintRules ( handler . getHintRules ( ) ) ; hints . setVendorDuplicatingHintRules ( handler . getVendorDuplicatingHintRules ( ) ) ; return hints ; } } catch ( ParserConfigurationException | FileNotFoundException ex ) { LOGGER . debug ( "" , ex ) ; throw new HintParseException ( ex ) ; } catch ( SAXException ex ) { if ( ex . getMessage ( ) . contains ( "Cannot find the declaration of element 'hints'." ) ) { throw ex ; } else { LOGGER . debug ( "" , ex ) ; throw new HintParseException ( ex ) ; } } catch ( IOException ex ) { LOGGER . debug ( "" , ex ) ; throw new HintParseException ( ex ) ; } }
Parses the given XML stream and returns a list of the hint rules
 contained.
Parses the given XML stream and returns a list of the hint rules contained .