1 | /*
|
---|
2 | * Copyright 1999-2000,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: DeclHandler.hpp,v $
|
---|
19 | * Revision 1.4 2004/09/08 13:56:20 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.3 2003/03/07 18:10:30 tng
|
---|
23 | * Return a reference instead of void for operator=
|
---|
24 | *
|
---|
25 | * Revision 1.2 2002/11/04 14:55:45 tng
|
---|
26 | * C++ Namespace Support.
|
---|
27 | *
|
---|
28 | * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz
|
---|
29 | * sane_include
|
---|
30 | *
|
---|
31 | * Revision 1.1 2002/01/28 17:08:33 knoaman
|
---|
32 | * SAX2-ext's DeclHandler support.
|
---|
33 | *
|
---|
34 | */
|
---|
35 |
|
---|
36 |
|
---|
37 | #ifndef DECLHANDLER_HPP
|
---|
38 | #define DECLHANDLER_HPP
|
---|
39 |
|
---|
40 | #include <xercesc/util/XercesDefs.hpp>
|
---|
41 |
|
---|
42 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * Receive notification of DTD declaration events.
|
---|
46 | *
|
---|
47 | * <p>This is an optional extension handler for SAX2 to provide more
|
---|
48 | * complete information about DTD declarations in an XML document.
|
---|
49 | * XML readers are not required to recognize this handler, and it is not
|
---|
50 | * part of core-only SAX2 distributions.</p>
|
---|
51 | *
|
---|
52 | * <p>Note that data-related DTD declarations (unparsed entities and
|
---|
53 | * notations) are already reported through the DTDHandler interface.</p>
|
---|
54 | *
|
---|
55 | * <p>If you are using the declaration handler together with a lexical
|
---|
56 | * handler, all of the events will occur between the startDTD and the endDTD
|
---|
57 | * events.</p>
|
---|
58 | *
|
---|
59 | * @see SAX2XMLReader#setLexicalHandler
|
---|
60 | * @see SAX2XMLReader#setDeclarationHandler
|
---|
61 | */
|
---|
62 |
|
---|
63 | class SAX2_EXPORT DeclHandler
|
---|
64 | {
|
---|
65 | public:
|
---|
66 | /** @name Constructors and Destructor */
|
---|
67 | //@{
|
---|
68 | /** Default constructor */
|
---|
69 | DeclHandler()
|
---|
70 | {
|
---|
71 | }
|
---|
72 |
|
---|
73 | /** Destructor */
|
---|
74 | virtual ~DeclHandler()
|
---|
75 | {
|
---|
76 | }
|
---|
77 | //@}
|
---|
78 |
|
---|
79 | /** @name The virtual declaration handler interface */
|
---|
80 |
|
---|
81 | //@{
|
---|
82 | /**
|
---|
83 | * Report an element type declaration.
|
---|
84 | *
|
---|
85 | * <p>The content model will consist of the string "EMPTY", the string
|
---|
86 | * "ANY", or a parenthesised group, optionally followed by an occurrence
|
---|
87 | * indicator. The model will be normalized so that all parameter entities
|
---|
88 | * are fully resolved and all whitespace is removed,and will include the
|
---|
89 | * enclosing parentheses. Other normalization (such as removing redundant
|
---|
90 | * parentheses or simplifying occurrence indicators) is at the discretion
|
---|
91 | * of the parser.</p>
|
---|
92 | *
|
---|
93 | * @param name The element type name.
|
---|
94 | * @param model The content model as a normalized string.
|
---|
95 | * @exception SAXException Any SAX exception, possibly
|
---|
96 | * wrapping another exception.
|
---|
97 | */
|
---|
98 | virtual void elementDecl
|
---|
99 | (
|
---|
100 | const XMLCh* const name
|
---|
101 | , const XMLCh* const model
|
---|
102 | ) = 0;
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Report an attribute type declaration.
|
---|
106 | *
|
---|
107 | * <p>The Parser will call this method to report each occurence of
|
---|
108 | * a comment in the XML document.</p>
|
---|
109 | *
|
---|
110 | * <p>The application must not attempt to read from the array
|
---|
111 | * outside of the specified range.</p>
|
---|
112 | *
|
---|
113 | * @param eName The name of the associated element.
|
---|
114 | * @param aName The name of the attribute.
|
---|
115 | * @param type A string representing the attribute type.
|
---|
116 | * @param mode A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
|
---|
117 | * @param value A string representing the attribute's default value, or null if there is none.
|
---|
118 | * @exception SAXException Any SAX exception, possibly
|
---|
119 | * wrapping another exception.
|
---|
120 | */
|
---|
121 | virtual void attributeDecl
|
---|
122 | (
|
---|
123 | const XMLCh* const eName
|
---|
124 | , const XMLCh* const aName
|
---|
125 | , const XMLCh* const type
|
---|
126 | , const XMLCh* const mode
|
---|
127 | , const XMLCh* const value
|
---|
128 | ) = 0;
|
---|
129 |
|
---|
130 | /**
|
---|
131 | * Report an internal entity declaration.
|
---|
132 | *
|
---|
133 | * <p>Only the effective (first) declaration for each entity will be
|
---|
134 | * reported. All parameter entities in the value will be expanded, but
|
---|
135 | * general entities will not.</p>
|
---|
136 | *
|
---|
137 | * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'.
|
---|
138 | * @param value The replacement text of the entity.
|
---|
139 | * @exception SAXException Any SAX exception, possibly
|
---|
140 | * wrapping another exception.
|
---|
141 | */
|
---|
142 | virtual void internalEntityDecl
|
---|
143 | (
|
---|
144 | const XMLCh* const name
|
---|
145 | , const XMLCh* const value
|
---|
146 | ) = 0;
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Report a parsed external entity declaration.
|
---|
150 | *
|
---|
151 | * <p>Only the effective (first) declaration for each entity will
|
---|
152 | * be reported.</p>
|
---|
153 | *
|
---|
154 | * @param name The name of the entity. If it is a parameter entity, the name will begin with '%'.
|
---|
155 | * @param publicId The The declared public identifier of the entity, or null if none was declared.
|
---|
156 | * @param systemId The declared system identifier of the entity.
|
---|
157 | * @exception SAXException Any SAX exception, possibly
|
---|
158 | * wrapping another exception.
|
---|
159 | */
|
---|
160 | virtual void externalEntityDecl
|
---|
161 | (
|
---|
162 | const XMLCh* const name
|
---|
163 | , const XMLCh* const publicId
|
---|
164 | , const XMLCh* const systemId
|
---|
165 | ) = 0;
|
---|
166 |
|
---|
167 | //@}
|
---|
168 | private :
|
---|
169 | /* Unimplemented Constructors and operators */
|
---|
170 | /* Copy constructor */
|
---|
171 | DeclHandler(const DeclHandler&);
|
---|
172 | /** Assignment operator */
|
---|
173 | DeclHandler& operator=(const DeclHandler&);
|
---|
174 | };
|
---|
175 |
|
---|
176 | XERCES_CPP_NAMESPACE_END
|
---|
177 |
|
---|
178 | #endif
|
---|