001    package com.thaiopensource.validate;
002    
003    import com.thaiopensource.util.PropertyMap;
004    
005    /**
006     * A schema that can be used to validate an XML document. A single <code>Schema</code> object
007     * is safe for concurrent access by multiple threads.
008     *
009     * @see SchemaReader
010     * @see Validator
011     *
012     * @author <a href="mailto:jjc@jclark.com">James Clark</a>
013     */
014    public interface Schema {
015      /**
016       * Creates a new <code>Validator</code> that can be used to validate XML documents with
017       * respect to this schema.  The <code>PropertyMap</code> should contain a
018       * <code>ValidateProperty.ERROR_HANDLER</code> property, which will be
019       * used to report errors.  If it does not, then an <code>ErrorHandler</code>
020       * will be used that ignores warnings and throws its argument on errors and fatal errors.
021       * Common properties are defined in <code>ValidateProperty</code>.  Implementations
022       * may support additional properties.
023       *
024       * @param properties a <code>PropertyMap</code> specifying the properties of the
025       * <code>Validator</code> to be created
026       * @return a new <code>Validator</code> that can be used to validate an XML document
027       * with respect to this schema; never <code>null</code>
028       *
029       * @see ValidateProperty#ERROR_HANDLER
030       */
031      Validator createValidator(PropertyMap properties);
032      PropertyMap getProperties();
033    }