@Override
    public void process(Exchange exchange) throws Exception {
        final SchematronProcessor schematronProcessor = SchematronProcessorFactory.newSchematronEngine(endpoint.getRules());
        final Object payload = exchange.getIn().getBody();
        final String report;

        if (payload instanceof Source) {
            LOG.debug("Applying schematron validation on payload: {}", payload);
            report = schematronProcessor.validate((Source) payload);
        } else if (payload instanceof String) {
            LOG.debug("Applying schematron validation on payload: {}", payload);
            report = schematronProcessor.validate((String) payload);
        } else {
            String stringPayload = exchange.getIn().getBody(String.class);
            LOG.debug("Applying schematron validation on payload: {}", stringPayload);
            report = schematronProcessor.validate(stringPayload);
        }

        LOG.debug("Schematron validation report \n {}", report);
        String status = getValidationStatus(report);
        LOG.info("Schematron validation status : {}", status);
        setValidationReport(exchange, report, status);
    }
@Test
    public void testProcessValidXMLAsSource() throws Exception {
        Exchange exc = new DefaultExchange(context, ExchangePattern.InOut);
        exc.getIn().setBody(
                new SAXSource(getXMLReader(), new InputSource(ClassLoader.getSystemResourceAsStream("xml/article-1.xml"))));

        // process xml payload
        producer.process(exc);

        // assert
        assertEquals(Constants.SUCCESS, exc.getMessage().getHeader(Constants.VALIDATION_STATUS));
    }