/luni/src/main/java/javax/xml/validation/Schema.java

https://bitbucket.org/aways/android_libcore · Java · 92 lines · 7 code · 6 blank · 79 comment · 0 complexity · 67be6d8f2d830c5761a84b19755bc370 MD5 · raw file

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. 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. // $Id: Schema.java 446598 2006-09-15 12:55:40Z jeremias $
  18. package javax.xml.validation;
  19. /**
  20. * Immutable in-memory representation of grammar.
  21. *
  22. * <p>
  23. * This object represents a set of constraints that can be checked/
  24. * enforced against an XML document.
  25. *
  26. * <p>
  27. * A {@link Schema} object is thread safe and applications are
  28. * encouraged to share it across many parsers in many threads.
  29. *
  30. * <p>
  31. * A {@link Schema} object is immutable in the sense that it shouldn't
  32. * change the set of constraints once it is created. In other words,
  33. * if an application validates the same document twice against the same
  34. * {@link Schema}, it must always produce the same result.
  35. *
  36. * <p>
  37. * A {@link Schema} object is usually created from {@link SchemaFactory}.
  38. *
  39. * <p>
  40. * Two kinds of validators can be created from a {@link Schema} object.
  41. * One is {@link Validator}, which provides highly-level validation
  42. * operations that cover typical use cases. The other is
  43. * {@link ValidatorHandler}, which works on top of SAX for better
  44. * modularity.
  45. *
  46. * <p>
  47. * This specification does not refine
  48. * the {@link java.lang.Object#equals(java.lang.Object)} method.
  49. * In other words, if you parse the same schema twice, you may
  50. * still get <code>!schemaA.equals(schemaB)</code>.
  51. *
  52. * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
  53. * @version $Revision: 446598 $, $Date: 2006-09-15 05:55:40 -0700 (Fri, 15 Sep 2006) $
  54. * @see <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a>
  55. * @see <a href="http://www.w3.org/TR/xml11/">Extensible Markup Language (XML) 1.1</a>
  56. * @see <a href="http://www.w3.org/TR/REC-xml">Extensible Markup Language (XML) 1.0 (Second Edition)</a>
  57. * @since 1.5
  58. */
  59. public abstract class Schema {
  60. /**
  61. * Constructor for the derived class.
  62. *
  63. * <p>
  64. * The constructor does nothing.
  65. */
  66. protected Schema() {
  67. }
  68. /**
  69. * Creates a new {@link Validator} for this {@link Schema}.
  70. *
  71. * <p>
  72. * A validator enforces/checks the set of constraints this object
  73. * represents.
  74. *
  75. * @return
  76. * Always return a non-null valid object.
  77. */
  78. public abstract Validator newValidator();
  79. /**
  80. * Creates a new {@link ValidatorHandler} for this {@link Schema}.
  81. *
  82. * @return
  83. * Always return a non-null valid object.
  84. */
  85. public abstract ValidatorHandler newValidatorHandler();
  86. }