camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johan Mörén (JIRA) <>
Subject [jira] [Commented] (CAMEL-8287) Schematron component does not work with includes in schematron
Date Tue, 09 Aug 2016 14:29:20 GMT


Johan Mörén commented on CAMEL-8287:

I'v been trying some things out and found that a possible way to fix this issue is to allow
the user to configure the endpoint with an optional "Client" URIResolver. 

<to id="DD_METS-schematron-validation" uri="schematron:metadata/schematron/identifier_checks.sch?uriResolver=#customUriResolver"/>

This resolver would then be included in the components ClassPathURIResolver and be used as
a fallback if the first resolve fail and the clientUriResolver is not null. 

like this :
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.apache.camel.component.schematron.processor;

import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;

 * Class path resolver for schematron templates
public class ClassPathURIResolver implements URIResolver {

    private final String rulesDir;
    private final URIResolver clientUriResolver;

     * Constructor setter for rules directory path.
    public ClassPathURIResolver(final String rulesDir, URIResolver clientUriResolver) {
        this.rulesDir = rulesDir;
        this.clientUriResolver = clientUriResolver;

    public Source resolve(String href, String base) throws TransformerException {
        InputStream stream = ClassPathURIResolver.class.getClassLoader()

        if (null != stream) {
            return new StreamSource(stream);
        } else {
            if (null != clientUriResolver) {
                return clientUriResolver.resolve(href, base);
            } else {
                return new StreamSource(stream);


We use version 2.15.3 of camel so i've based my experiments on this version of the component.

> Schematron component does not work with includes in schematron
> --------------------------------------------------------------
>                 Key: CAMEL-8287
>                 URL:
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-schematron
>    Affects Versions: 2.14.1
>            Reporter: Thomas Walzer
>            Assignee: ayache khettar
>            Priority: Minor
>         Attachments: 0001-add-test-for-schematron-with-includes.patch
> I have a schematron with includes:
>  <pattern>
>       <include href="include/DTr1_ANY.sch"/>
> ....
> </pattern>
> when I run against this schematron I get the following error:
> Recoverable error on line 472 
>   FODC0002: I/O error reported by XML parser processing null: null
> Unable to open referenced included file: include/DTr1_ANY.sch
> Unable to locate id attribute: include/DTr1_ANY.sch
> Recoverable error on line 472 
> There is question with an answer on stackoverflow that seems applicable to me:
> BTW: camel-schematron is not yet a component in JIRA.
> Many thanks in advance!
> Thomas.

This message was sent by Atlassian JIRA

View raw message