Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/javax/xml/validation/Schema.java
32285 views
/*1* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.validation;2627/**28* Immutable in-memory representation of grammar.29*30* <p>31* This object represents a set of constraints that can be checked/32* enforced against an XML document.33*34* <p>35* A {@link Schema} object is thread safe and applications are36* encouraged to share it across many parsers in many threads.37*38* <p>39* A {@link Schema} object is immutable in the sense that it shouldn't40* change the set of constraints once it is created. In other words,41* if an application validates the same document twice against the same42* {@link Schema}, it must always produce the same result.43*44* <p>45* A {@link Schema} object is usually created from {@link SchemaFactory}.46*47* <p>48* Two kinds of validators can be created from a {@link Schema} object.49* One is {@link Validator}, which provides highly-level validation50* operations that cover typical use cases. The other is51* {@link ValidatorHandler}, which works on top of SAX for better52* modularity.53*54* <p>55* This specification does not refine56* the {@link java.lang.Object#equals(java.lang.Object)} method.57* In other words, if you parse the same schema twice, you may58* still get <code>!schemaA.equals(schemaB)</code>.59*60* @author <a href="mailto:[email protected]">Kohsuke Kawaguchi</a>61* @see <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a>62* @see <a href="http://www.w3.org/TR/xml11/">Extensible Markup Language (XML) 1.1</a>63* @see <a href="http://www.w3.org/TR/REC-xml">Extensible Markup Language (XML) 1.0 (Second Edition)</a>64* @since 1.565*/66public abstract class Schema {6768/**69* Constructor for the derived class.70*71* <p>72* The constructor does nothing.73*/74protected Schema() {75}7677/**78* Creates a new {@link Validator} for this {@link Schema}.79*80* <p>A validator enforces/checks the set of constraints this object81* represents.</p>82*83* <p>Implementors should assure that the properties set on the84* {@link SchemaFactory} that created this {@link Schema} are also85* set on the {@link Validator} constructed.</p>86*87* @return88* Always return a non-null valid object.89*/90public abstract Validator newValidator();9192/**93* Creates a new {@link ValidatorHandler} for this {@link Schema}.94*95* <p>Implementors should assure that the properties set on the96* {@link SchemaFactory} that created this {@link Schema} are also97* set on the {@link ValidatorHandler} constructed.</p>98*99* @return100* Always return a non-null valid object.101*/102public abstract ValidatorHandler newValidatorHandler();103}104105106