class WebXmlParser {

    public WebXml parse(InputStream inputStream) {
        WebXml webXml = new WebXml();
        try {
            DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document document = documentBuilder.parse(inputStream);
            XPath xPath = XPathFactory.newInstance().newXPath();
            parseAbsoluteOrdering(webXml, xPath, document);
            parseOrdering(webXml, xPath, document);
            parseContextParameters(webXml, xPath, document);
            parseDefaultContextPath(webXml, xPath, document);
            parseDenyUncoveredHttpMethods(webXml, xPath, document);
            parseDisplayName(webXml, xPath, document);
            parseFragmentName(webXml, xPath, document);
            parseDistributable(webXml, xPath, document);
            parseErrorPages(webXml, xPath, document);
            parseFilterMappings(webXml, xPath, document);
            parseFilters(webXml, xPath, document);
            parseListeners(webXml, xPath, document);
            parseLoginConfig(webXml, xPath, document);
            parseMimeMappings(webXml, xPath, document);
            parseRequestCharacterEncoding(webXml, xPath, document);
            parseResponseCharacterEncoding(webXml, xPath, document);
            parseLocaleEncodingMapping(webXml, xPath, document);
            processSecurityConstraints(webXml, xPath, document);
            processSecurityRoles(webXml, xPath, document);
            parseServletMappings(webXml, xPath, document);
            parseServlets(webXml, xPath, document);
            parseSessionConfig(webXml, xPath, document);
            parseWebApp(webXml, xPath, document);
            parseWelcomeFiles(webXml, xPath, document);
        } catch (Throwable t) {
            LOGGER.log(WARNING, "Unable to parse web.xml", t);
        }
        return webXml;
    }

}