Code example for ParserConfigurationException

Methods: getMessage

0
        XMLReader xmlReader;
        try { 
            saxParser = parserFactory.newSAXParser();
            xmlReader = saxParser.getXMLReader();
        } catch (ParserConfigurationException e) {
            throw new JAXBException("Parser configuration error: " + e.getMessage(), e);
        } catch (SAXException e) {
            throw new JAXBException("SAX error: " + e.getMessage(), e);
        } 
        EntityResolver entityResolver = new EntityResolver() {
            public InputSource resolveEntity(String publicId, String systemId) {
                if (systemId != null && systemId.contains("viamichelin") && systemId.endsWith("export.dtd"))
                    return new InputSource(new ByteArrayInputStream(XML_PREAMBLE.getBytes()));
                else 
                    return null; 
            } 
        }; 
        xmlReader.setEntityResolver(entityResolver);
        return xmlReader;
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE