View Javadoc
1   /**
2    * Copyright (C) 2014-2017 Philip Helger (www.helger.com)
3    * philip[at]helger[dot]com
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *         http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package com.helger.schematron.xslt;
18  
19  import javax.annotation.Nullable;
20  import javax.xml.transform.Transformer;
21  import javax.xml.transform.TransformerConfigurationException;
22  
23  import org.w3c.dom.Document;
24  
25  /**
26   * Interface for a factory creating Schematron validators from XSLT. Sometimes
27   * the pre-built XSLTs are already available, and sometimes they need to be
28   * built from the underlying Schematron file.
29   *
30   * @author Philip Helger
31   */
32  public interface ISchematronXSLTBasedProvider
33  {
34    /**
35     * @return <code>true</code> if the Schematron was successfully interpreted,
36     *         <code>false</code> otherwise.
37     */
38    boolean isValidSchematron ();
39  
40    /**
41     * @return The produced XSLT document from the Schematron document or
42     *         <code>null</code> if preprocessing failed.
43     * @see #isValidSchematron()
44     */
45    @Nullable
46    Document getXSLTDocument ();
47  
48    /**
49     * @return The XSLT transformer to be used. May be <code>null</code> if the
50     *         compilation of the XSLT failed.
51     * @throws TransformerConfigurationException
52     *         In case of an internal error
53     */
54    @Nullable
55    Transformer getXSLTTransformer () throws TransformerConfigurationException;
56  }