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