| 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: DeclHandler.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | #ifndef DECLHANDLER_HPP |
|---|
| 24 | #define DECLHANDLER_HPP |
|---|
| 25 | |
|---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
|---|
| 27 | |
|---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * Receive notification of DTD declaration events. |
|---|
| 32 | * |
|---|
| 33 | * <p>This is an optional extension handler for SAX2 to provide more |
|---|
| 34 | * complete information about DTD declarations in an XML document. |
|---|
| 35 | * XML readers are not required to recognize this handler, and it is not |
|---|
| 36 | * part of core-only SAX2 distributions.</p> |
|---|
| 37 | * |
|---|
| 38 | * <p>Note that data-related DTD declarations (unparsed entities and |
|---|
| 39 | * notations) are already reported through the DTDHandler interface.</p> |
|---|
| 40 | * |
|---|
| 41 | * <p>If you are using the declaration handler together with a lexical |
|---|
| 42 | * handler, all of the events will occur between the startDTD and the endDTD |
|---|
| 43 | * events.</p> |
|---|
| 44 | * |
|---|
| 45 | * @see SAX2XMLReader#setLexicalHandler |
|---|
| 46 | * @see SAX2XMLReader#setDeclarationHandler |
|---|
| 47 | */ |
|---|
| 48 | |
|---|
| 49 | class SAX2_EXPORT DeclHandler |
|---|
| 50 | { |
|---|
| 51 | public: |
|---|
| 52 | /** @name Constructors and Destructor */ |
|---|
| 53 | //@{ |
|---|
| 54 | /** Default constructor */ |
|---|
| 55 | DeclHandler() |
|---|
| 56 | { |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | /** Destructor */ |
|---|
| 60 | virtual ~DeclHandler() |
|---|
| 61 | { |
|---|
| 62 | } |
|---|
| 63 | //@} |
|---|
| 64 | |
|---|
| 65 | /** @name The virtual declaration handler interface */ |
|---|
| 66 | |
|---|
| 67 | //@{ |
|---|
| 68 | /** |
|---|
| 69 | * Report an element type declaration. |
|---|
| 70 | * |
|---|
| 71 | * <p>The content model will consist of the string "EMPTY", the string |
|---|
| 72 | * "ANY", or a parenthesised group, optionally followed by an occurrence |
|---|
| 73 | * indicator. The model will be normalized so that all parameter entities |
|---|
| 74 | * are fully resolved and all whitespace is removed,and will include the |
|---|
| 75 | * enclosing parentheses. Other normalization (such as removing redundant |
|---|
| 76 | * parentheses or simplifying occurrence indicators) is at the discretion |
|---|
| 77 | * of the parser.</p> |
|---|
| 78 | * |
|---|
| 79 | * @param name The element type name. |
|---|
| 80 | * @param model The content model as a normalized string. |
|---|
| 81 | * @exception SAXException Any SAX exception, possibly |
|---|
| 82 | * wrapping another exception. |
|---|
| 83 | */ |
|---|
| 84 | virtual void elementDecl |
|---|
| 85 | ( |
|---|
| 86 | const XMLCh* const name |
|---|
| 87 | , const XMLCh* const model |
|---|
| 88 | ) = 0; |
|---|
| 89 | |
|---|
| 90 | /** |
|---|
| 91 | * Report an attribute type declaration. |
|---|
| 92 | * |
|---|
| 93 | * <p>The Parser will call this method to report each occurence of |
|---|
| 94 | * a comment in the XML document.</p> |
|---|
| 95 | * |
|---|
| 96 | * <p>The application must not attempt to read from the array |
|---|
| 97 | * outside of the specified range.</p> |
|---|
| 98 | * |
|---|
| 99 | * @param eName The name of the associated element. |
|---|
| 100 | * @param aName The name of the attribute. |
|---|
| 101 | * @param type A string representing the attribute type. |
|---|
| 102 | * @param mode A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies. |
|---|
| 103 | * @param value A string representing the attribute's default value, or null if there is none. |
|---|
| 104 | * @exception SAXException Any SAX exception, possibly |
|---|
| 105 | * wrapping another exception. |
|---|
| 106 | */ |
|---|
| 107 | virtual void attributeDecl |
|---|
| 108 | ( |
|---|
| 109 | const XMLCh* const eName |
|---|
| 110 | , const XMLCh* const aName |
|---|
| 111 | , const XMLCh* const type |
|---|
| 112 | , const XMLCh* const mode |
|---|
| 113 | , const XMLCh* const value |
|---|
| 114 | ) = 0; |
|---|
| 115 | |
|---|
| 116 | /** |
|---|
| 117 | * Report an internal entity declaration. |
|---|
| 118 | * |
|---|
| 119 | * <p>Only the effective (first) declaration for each entity will be |
|---|
| 120 | * reported. All parameter entities in the value will be expanded, but |
|---|
| 121 | * general entities will not.</p> |
|---|
| 122 | * |
|---|
| 123 | * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'. |
|---|
| 124 | * @param value The replacement text of the entity. |
|---|
| 125 | * @exception SAXException Any SAX exception, possibly |
|---|
| 126 | * wrapping another exception. |
|---|
| 127 | */ |
|---|
| 128 | virtual void internalEntityDecl |
|---|
| 129 | ( |
|---|
| 130 | const XMLCh* const name |
|---|
| 131 | , const XMLCh* const value |
|---|
| 132 | ) = 0; |
|---|
| 133 | |
|---|
| 134 | /** |
|---|
| 135 | * Report a parsed external entity declaration. |
|---|
| 136 | * |
|---|
| 137 | * <p>Only the effective (first) declaration for each entity will |
|---|
| 138 | * be reported.</p> |
|---|
| 139 | * |
|---|
| 140 | * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'. |
|---|
| 141 | * @param publicId The The declared public identifier of the entity, or null if none was declared. |
|---|
| 142 | * @param systemId The declared system identifier of the entity. |
|---|
| 143 | * @exception SAXException Any SAX exception, possibly |
|---|
| 144 | * wrapping another exception. |
|---|
| 145 | */ |
|---|
| 146 | virtual void externalEntityDecl |
|---|
| 147 | ( |
|---|
| 148 | const XMLCh* const name |
|---|
| 149 | , const XMLCh* const publicId |
|---|
| 150 | , const XMLCh* const systemId |
|---|
| 151 | ) = 0; |
|---|
| 152 | |
|---|
| 153 | //@} |
|---|
| 154 | private : |
|---|
| 155 | /* Unimplemented Constructors and operators */ |
|---|
| 156 | /* Copy constructor */ |
|---|
| 157 | DeclHandler(const DeclHandler&); |
|---|
| 158 | /** Assignment operator */ |
|---|
| 159 | DeclHandler& operator=(const DeclHandler&); |
|---|
| 160 | }; |
|---|
| 161 | |
|---|
| 162 | XERCES_CPP_NAMESPACE_END |
|---|
| 163 | |
|---|
| 164 | #endif |
|---|