| 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 | |
|---|
| 18 | /* |
|---|
| 19 | * $Id: DTDHandler.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | #ifndef DTDHANDLER_HPP |
|---|
| 24 | #define DTDHANDLER_HPP |
|---|
| 25 | |
|---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
|---|
| 27 | |
|---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * Receive notification of basic DTD-related events. |
|---|
| 32 | * |
|---|
| 33 | * <p>If a SAX application needs information about notations and |
|---|
| 34 | * unparsed entities, then the application implements this |
|---|
| 35 | * interface and registers an instance with the SAX parser using |
|---|
| 36 | * the parser's setDTDHandler method. The parser uses the |
|---|
| 37 | * instance to report notation and unparsed entity declarations to |
|---|
| 38 | * the application.</p> |
|---|
| 39 | * |
|---|
| 40 | * <p>The SAX parser may report these events in any order, regardless |
|---|
| 41 | * of the order in which the notations and unparsed entities were |
|---|
| 42 | * declared; however, all DTD events must be reported after the |
|---|
| 43 | * document handler's startDocument event, and before the first |
|---|
| 44 | * startElement event.</p> |
|---|
| 45 | * |
|---|
| 46 | * <p>It is up to the application to store the information for |
|---|
| 47 | * future use (perhaps in a hash table or object tree). |
|---|
| 48 | * If the application encounters attributes of type "NOTATION", |
|---|
| 49 | * "ENTITY", or "ENTITIES", it can use the information that it |
|---|
| 50 | * obtained through this interface to find the entity and/or |
|---|
| 51 | * notation corresponding with the attribute value.</p> |
|---|
| 52 | * |
|---|
| 53 | * <p>The HandlerBase class provides a default implementation |
|---|
| 54 | * of this interface, which simply ignores the events.</p> |
|---|
| 55 | * |
|---|
| 56 | * @see Parser#setDTDHandler |
|---|
| 57 | * @see HandlerBase#HandlerBase |
|---|
| 58 | */ |
|---|
| 59 | |
|---|
| 60 | class SAX_EXPORT DTDHandler |
|---|
| 61 | { |
|---|
| 62 | public: |
|---|
| 63 | /** @name Constructors and Destructor */ |
|---|
| 64 | //@{ |
|---|
| 65 | /** Default Constructor */ |
|---|
| 66 | DTDHandler() |
|---|
| 67 | { |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | /** Destructor */ |
|---|
| 71 | virtual ~DTDHandler() |
|---|
| 72 | { |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | //@} |
|---|
| 76 | |
|---|
| 77 | /** @name The DTD handler interface */ |
|---|
| 78 | //@{ |
|---|
| 79 | /** |
|---|
| 80 | * Receive notification of a notation declaration event. |
|---|
| 81 | * |
|---|
| 82 | * <p>It is up to the application to record the notation for later |
|---|
| 83 | * reference, if necessary.</p> |
|---|
| 84 | * |
|---|
| 85 | * <p>If a system identifier is present, and it is a URL, the SAX |
|---|
| 86 | * parser must resolve it fully before passing it to the |
|---|
| 87 | * application.</p> |
|---|
| 88 | * |
|---|
| 89 | * @param name The notation name. |
|---|
| 90 | * @param publicId The notation's public identifier, or null if |
|---|
| 91 | * none was given. |
|---|
| 92 | * @param systemId The notation's system identifier, or null if |
|---|
| 93 | * none was given. |
|---|
| 94 | * @exception SAXException Any SAX exception, possibly |
|---|
| 95 | * wrapping another exception. |
|---|
| 96 | * @see #unparsedEntityDecl |
|---|
| 97 | * @see AttributeList#AttributeList |
|---|
| 98 | */ |
|---|
| 99 | virtual void notationDecl |
|---|
| 100 | ( |
|---|
| 101 | const XMLCh* const name |
|---|
| 102 | , const XMLCh* const publicId |
|---|
| 103 | , const XMLCh* const systemId |
|---|
| 104 | ) = 0; |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | * Receive notification of an unparsed entity declaration event. |
|---|
| 108 | * |
|---|
| 109 | * <p>Note that the notation name corresponds to a notation |
|---|
| 110 | * reported by the notationDecl() event. It is up to the |
|---|
| 111 | * application to record the entity for later reference, if |
|---|
| 112 | * necessary.</p> |
|---|
| 113 | * |
|---|
| 114 | * <p>If the system identifier is a URL, the parser must resolve it |
|---|
| 115 | * fully before passing it to the application.</p> |
|---|
| 116 | * |
|---|
| 117 | * @exception SAXException Any SAX exception, possibly |
|---|
| 118 | * wrapping another exception. |
|---|
| 119 | * @param name The unparsed entity's name. |
|---|
| 120 | * @param publicId The entity's public identifier, or null if none |
|---|
| 121 | * was given. |
|---|
| 122 | * @param systemId The entity's system identifier (it must always |
|---|
| 123 | * have one). |
|---|
| 124 | * @param notationName The name of the associated notation. |
|---|
| 125 | * @see #notationDecl |
|---|
| 126 | * @see AttributeList#AttributeList |
|---|
| 127 | */ |
|---|
| 128 | virtual void unparsedEntityDecl |
|---|
| 129 | ( |
|---|
| 130 | const XMLCh* const name |
|---|
| 131 | , const XMLCh* const publicId |
|---|
| 132 | , const XMLCh* const systemId |
|---|
| 133 | , const XMLCh* const notationName |
|---|
| 134 | ) = 0; |
|---|
| 135 | |
|---|
| 136 | /** |
|---|
| 137 | * Reset the DocType object on its reuse |
|---|
| 138 | * |
|---|
| 139 | * <p>This method helps in reseting the DTD object implementational |
|---|
| 140 | * defaults each time the DTD is begun.</p> |
|---|
| 141 | * |
|---|
| 142 | */ |
|---|
| 143 | virtual void resetDocType() = 0; |
|---|
| 144 | |
|---|
| 145 | //@} |
|---|
| 146 | |
|---|
| 147 | private : |
|---|
| 148 | /* Unimplemented constructors and operators */ |
|---|
| 149 | |
|---|
| 150 | /* Copy constructor */ |
|---|
| 151 | DTDHandler(const DTDHandler&); |
|---|
| 152 | |
|---|
| 153 | /* Assignment operator */ |
|---|
| 154 | DTDHandler& operator=(const DTDHandler&); |
|---|
| 155 | |
|---|
| 156 | }; |
|---|
| 157 | |
|---|
| 158 | XERCES_CPP_NAMESPACE_END |
|---|
| 159 | |
|---|
| 160 | #endif |
|---|