1. // SAX DTD handler.
  2. // No warranty; no copyright -- use this as you will.
  3. // $Id: DTDHandler.java,v 1.1 2001/05/20 03:12:56 curcuru Exp $
  4. package org.xml.sax;
  5. /**
  6. * Receive notification of basic DTD-related events.
  7. *
  8. * <blockquote>
  9. * <em>This module, both source code and documentation, is in the
  10. * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  11. * </blockquote>
  12. *
  13. * <p>If a SAX application needs information about notations and
  14. * unparsed entities, then the application implements this
  15. * interface and registers an instance with the SAX parser using
  16. * the parser's setDTDHandler method. The parser uses the
  17. * instance to report notation and unparsed entity declarations to
  18. * the application.</p>
  19. *
  20. * <p>Note that this interface includes only those DTD events that
  21. * the XML recommendation <em>requires</em> processors to report:
  22. * notation and unparsed entity declarations.</p>
  23. *
  24. * <p>The SAX parser may report these events in any order, regardless
  25. * of the order in which the notations and unparsed entities were
  26. * declared; however, all DTD events must be reported after the
  27. * document handler's startDocument event, and before the first
  28. * startElement event.</p>
  29. *
  30. * <p>It is up to the application to store the information for
  31. * future use (perhaps in a hash table or object tree).
  32. * If the application encounters attributes of type "NOTATION",
  33. * "ENTITY", or "ENTITIES", it can use the information that it
  34. * obtained through this interface to find the entity and/or
  35. * notation corresponding with the attribute value.</p>
  36. *
  37. * @since SAX 1.0
  38. * @author David Megginson,
  39. * <a href="mailto:sax@megginson.com">sax@megginson.com</a>
  40. * @version 2.0r2pre
  41. * @see org.xml.sax.Parser#setDTDHandler
  42. * @see org.xml.sax.HandlerBase
  43. */
  44. public interface DTDHandler {
  45. /**
  46. * Receive notification of a notation declaration event.
  47. *
  48. * <p>It is up to the application to record the notation for later
  49. * reference, if necessary.</p>
  50. *
  51. * <p>At least one of publicId and systemId must be non-null.
  52. * If a system identifier is present, and it is a URL, the SAX
  53. * parser must resolve it fully before passing it to the
  54. * application through this event.</p>
  55. *
  56. * <p>There is no guarantee that the notation declaration will be
  57. * reported before any unparsed entities that use it.</p>
  58. *
  59. * @param name The notation name.
  60. * @param publicId The notation's public identifier, or null if
  61. * none was given.
  62. * @param systemId The notation's system identifier, or null if
  63. * none was given.
  64. * @exception org.xml.sax.SAXException Any SAX exception, possibly
  65. * wrapping another exception.
  66. * @see #unparsedEntityDecl
  67. * @see org.xml.sax.AttributeList
  68. */
  69. public abstract void notationDecl (String name,
  70. String publicId,
  71. String systemId)
  72. throws SAXException;
  73. /**
  74. * Receive notification of an unparsed entity declaration event.
  75. *
  76. * <p>Note that the notation name corresponds to a notation
  77. * reported by the {@link #notationDecl notationDecl} event.
  78. * It is up to the application to record the entity for later
  79. * reference, if necessary.</p>
  80. *
  81. * <p>If the system identifier is a URL, the parser must resolve it
  82. * fully before passing it to the application.</p>
  83. *
  84. * @exception org.xml.sax.SAXException Any SAX exception, possibly
  85. * wrapping another exception.
  86. * @param name The unparsed entity's name.
  87. * @param publicId The entity's public identifier, or null if none
  88. * was given.
  89. * @param systemId The entity's system identifier.
  90. * @param notation name The name of the associated notation.
  91. * @see #notationDecl
  92. * @see org.xml.sax.AttributeList
  93. */
  94. public abstract void unparsedEntityDecl (String name,
  95. String publicId,
  96. String systemId,
  97. String notationName)
  98. throws SAXException;
  99. }
  100. // end of DTDHandler.java