1. // $Id: Schema.java,v 1.4 2003/12/06 00:21:36 jsuttor Exp $
  2. /*
  3. * @(#)Schema.java 1.5 04/07/26
  4. *
  5. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  6. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  7. */
  8. package javax.xml.validation;
  9. /**
  10. * Immutable in-memory representation of grammar.
  11. *
  12. * <p>
  13. * This object represents a set of constraints that can be checked/
  14. * enforced against an XML document.
  15. *
  16. * <p>
  17. * A {@link Schema} object is thread safe and applications are
  18. * encouraged to share it across many parsers in many threads.
  19. *
  20. * <p>
  21. * A {@link Schema} object is immutable in the sense that it shouldn't
  22. * change the set of constraints once it is created. In other words,
  23. * if an application validates the same document twice against the same
  24. * {@link Schema}, it must always produce the same result.
  25. *
  26. * <p>
  27. * A {@link Schema} object is usually created from {@link SchemaFactory}.
  28. *
  29. * <p>
  30. * Two kinds of validators can be created from a {@link Schema} object.
  31. * One is {@link Validator}, which provides highly-level validation
  32. * operations that cover typical use cases. The other is
  33. * {@link ValidatorHandler}, which works on top of SAX for better
  34. * modularity.
  35. *
  36. * <p>
  37. * This specification does not refine
  38. * the {@link java.lang.Object#equals(java.lang.Object)} method.
  39. * In other words, if you parse the same schema twice, you may
  40. * still get <code>!schemaA.equals(schemaB)</code>.
  41. *
  42. * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
  43. * @version $Revision: 1.4 $, $Date: 2003/12/06 00:21:36 $
  44. * @see <a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a>
  45. * @see <a href="http://www.w3.org/TR/xml11/">Extensible Markup Language (XML) 1.1</a>
  46. * @see <a href="http://www.w3.org/TR/REC-xml">Extensible Markup Language (XML) 1.0 (Second Edition)</a>
  47. * @since 1.5
  48. */
  49. public abstract class Schema {
  50. /**
  51. * Constructor for the derived class.
  52. *
  53. * <p>
  54. * The constructor does nothing.
  55. */
  56. protected Schema() {
  57. }
  58. /**
  59. * Creates a new {@link Validator} for this {@link Schema}.
  60. *
  61. * <p>
  62. * A validator enforces/checks the set of constraints this object
  63. * represents.
  64. *
  65. * @return
  66. * Always return a non-null valid object.
  67. */
  68. public abstract Validator newValidator();
  69. /**
  70. * Creates a new {@link ValidatorHandler} for this {@link Schema}.
  71. *
  72. * @return
  73. * Always return a non-null valid object.
  74. */
  75. public abstract ValidatorHandler newValidatorHandler();
  76. }