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: SAXParseException.hpp,v $
|
---|
19 | * Revision 1.7 2004/09/08 13:56:19 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.6 2003/12/01 23:23:26 neilg
|
---|
23 | * fix for bug 25118; thanks to Jeroen Witmond
|
---|
24 | *
|
---|
25 | * Revision 1.5 2003/08/13 15:43:24 knoaman
|
---|
26 | * Use memory manager when creating SAX exceptions.
|
---|
27 | *
|
---|
28 | * Revision 1.4 2003/05/15 18:27:05 knoaman
|
---|
29 | * Partial implementation of the configurable memory manager.
|
---|
30 | *
|
---|
31 | * Revision 1.3 2002/11/04 14:56:26 tng
|
---|
32 | * C++ Namespace Support.
|
---|
33 | *
|
---|
34 | * Revision 1.2 2002/05/27 18:33:07 tng
|
---|
35 | * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number.
|
---|
36 | *
|
---|
37 | * Revision 1.1.1.1 2002/02/01 22:22:08 peiyongz
|
---|
38 | * sane_include
|
---|
39 | *
|
---|
40 | * Revision 1.5 2000/02/24 20:12:55 abagchi
|
---|
41 | * Swat for removing Log from API docs
|
---|
42 | *
|
---|
43 | * Revision 1.4 2000/02/12 01:27:19 aruna1
|
---|
44 | * Documentation updated
|
---|
45 | *
|
---|
46 | * Revision 1.3 2000/02/09 19:24:49 abagchi
|
---|
47 | * Inserted documentation for constructors and destructors
|
---|
48 | *
|
---|
49 | * Revision 1.2 2000/02/06 07:47:58 rahulj
|
---|
50 | * Year 2K copyright swat.
|
---|
51 | *
|
---|
52 | * Revision 1.1.1.1 1999/11/09 01:07:47 twl
|
---|
53 | * Initial checkin
|
---|
54 | *
|
---|
55 | * Revision 1.2 1999/11/08 20:45:02 rahul
|
---|
56 | * Swat for adding in Product name and CVS comment log variable.
|
---|
57 | *
|
---|
58 | */
|
---|
59 |
|
---|
60 |
|
---|
61 | #ifndef SAXPARSEEXCEPTION_HPP
|
---|
62 | #define SAXPARSEEXCEPTION_HPP
|
---|
63 |
|
---|
64 | #include <xercesc/sax/SAXException.hpp>
|
---|
65 |
|
---|
66 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
67 |
|
---|
68 | class Locator;
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Encapsulate an XML parse error or warning.
|
---|
72 | *
|
---|
73 | * <p>This exception will include information for locating the error
|
---|
74 | * in the original XML document. Note that although the application
|
---|
75 | * will receive a SAXParseException as the argument to the handlers
|
---|
76 | * in the ErrorHandler interface, the application is not actually
|
---|
77 | * required to throw the exception; instead, it can simply read the
|
---|
78 | * information in it and take a different action.</p>
|
---|
79 | *
|
---|
80 | * <p>Since this exception is a subclass of SAXException, it
|
---|
81 | * inherits the ability to wrap another exception.</p>
|
---|
82 | *
|
---|
83 | * @see SAXException#SAXException
|
---|
84 | * @see Locator#Locator
|
---|
85 | * @see ErrorHandler#ErrorHandler
|
---|
86 | */
|
---|
87 | class SAX_EXPORT SAXParseException : public SAXException
|
---|
88 | {
|
---|
89 | public:
|
---|
90 | /** @name Constructors and Destructor */
|
---|
91 | //@{
|
---|
92 | /**
|
---|
93 | * Create a new SAXParseException from a message and a Locator.
|
---|
94 | *
|
---|
95 | * <p>This constructor is especially useful when an application is
|
---|
96 | * creating its own exception from within a DocumentHandler
|
---|
97 | * callback.</p>
|
---|
98 | *
|
---|
99 | * @param message The error or warning message.
|
---|
100 | * @param locator The locator object for the error or warning.
|
---|
101 | * @param manager Pointer to the memory manager to be used to
|
---|
102 | * allocate objects.
|
---|
103 | * @see Locator#Locator
|
---|
104 | * @see Parser#setLocale
|
---|
105 | */
|
---|
106 | SAXParseException(const XMLCh* const message, const Locator& locator,
|
---|
107 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
108 |
|
---|
109 |
|
---|
110 | /**
|
---|
111 | * Create a new SAXParseException.
|
---|
112 | *
|
---|
113 | * <p>This constructor is most useful for parser writers.</p>
|
---|
114 | *
|
---|
115 | * <p>If the system identifier is a URL, the parser must resolve it
|
---|
116 | * fully before creating the exception.</p>
|
---|
117 | *
|
---|
118 | * @param message The error or warning message.
|
---|
119 | * @param publicId The public identifer of the entity that generated
|
---|
120 | * the error or warning.
|
---|
121 | * @param systemId The system identifer of the entity that generated
|
---|
122 | * the error or warning.
|
---|
123 | * @param lineNumber The line number of the end of the text that
|
---|
124 | * caused the error or warning.
|
---|
125 | * @param columnNumber The column number of the end of the text that
|
---|
126 | * caused the error or warning.
|
---|
127 | * @param manager Pointer to the memory manager to be used to
|
---|
128 | * allocate objects.
|
---|
129 | * @see Parser#setLocale
|
---|
130 | */
|
---|
131 | SAXParseException
|
---|
132 | (
|
---|
133 | const XMLCh* const message
|
---|
134 | , const XMLCh* const publicId
|
---|
135 | , const XMLCh* const systemId
|
---|
136 | , const XMLSSize_t lineNumber
|
---|
137 | , const XMLSSize_t columnNumber
|
---|
138 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
139 | );
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Copy constructor
|
---|
143 | *
|
---|
144 | * @param toCopy The object to be copied
|
---|
145 | */
|
---|
146 | SAXParseException(const SAXParseException& toCopy);
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Destructor
|
---|
150 | */
|
---|
151 | ~SAXParseException();
|
---|
152 |
|
---|
153 | //@}
|
---|
154 |
|
---|
155 | /** @name Assignment operator */
|
---|
156 | //@{
|
---|
157 | /**
|
---|
158 | * Assignment operator
|
---|
159 | *
|
---|
160 | * @param toAssign The object to be copied through assignment
|
---|
161 | *
|
---|
162 | */
|
---|
163 | SAXParseException& operator=(const SAXParseException& toAssign);
|
---|
164 | //@}
|
---|
165 |
|
---|
166 | /** @name Getter methods */
|
---|
167 | //@{
|
---|
168 | /**
|
---|
169 | * The column number of the end of the text where the exception occurred.
|
---|
170 | *
|
---|
171 | * <p>The first column in a line is position 1.</p>
|
---|
172 | *
|
---|
173 | * @return An integer representing the column number, or -1
|
---|
174 | * if none is available.
|
---|
175 | * @see Locator#getColumnNumber
|
---|
176 | */
|
---|
177 | XMLSSize_t getColumnNumber() const;
|
---|
178 | /**
|
---|
179 | * The line number of the end of the text where the exception occurred.
|
---|
180 | *
|
---|
181 | * @return An integer representing the line number, or -1
|
---|
182 | * if none is available.
|
---|
183 | * @see Locator#getLineNumber
|
---|
184 | */
|
---|
185 | XMLSSize_t getLineNumber() const;
|
---|
186 | /**
|
---|
187 | * Get the public identifier of the entity where the exception occurred.
|
---|
188 | *
|
---|
189 | * @return A string containing the public identifier, or null
|
---|
190 | * if none is available.
|
---|
191 | * @see Locator#getPublicId
|
---|
192 | */
|
---|
193 | const XMLCh* getPublicId() const;
|
---|
194 | /**
|
---|
195 | * Get the system identifier of the entity where the exception occurred.
|
---|
196 | *
|
---|
197 | * <p>If the system identifier is a URL, it will be resolved
|
---|
198 | * fully.</p>
|
---|
199 | *
|
---|
200 | * @return A string containing the system identifier, or null
|
---|
201 | * if none is available.
|
---|
202 | * @see Locator#getSystemId
|
---|
203 | */
|
---|
204 | const XMLCh* getSystemId() const;
|
---|
205 | //@}
|
---|
206 |
|
---|
207 | private:
|
---|
208 | /* Data Members */
|
---|
209 |
|
---|
210 | /* The column in the source text where the error occured. */
|
---|
211 | XMLSSize_t fColumnNumber;
|
---|
212 | /* The line in the source text where the error occured. */
|
---|
213 | XMLSSize_t fLineNumber;
|
---|
214 | /* The public id of the file where the error occured. */
|
---|
215 | XMLCh* fPublicId;
|
---|
216 | /* The system id of the file where the error occured. */
|
---|
217 | XMLCh* fSystemId;
|
---|
218 |
|
---|
219 |
|
---|
220 | };
|
---|
221 |
|
---|
222 | XERCES_CPP_NAMESPACE_END
|
---|
223 |
|
---|
224 | #endif
|
---|