Xalan-C++ API Reference 1.12.0
SAX2Handler.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#if !defined(SAX2HANDLER_1357924680)
20#define SAX2HANDLER_1357924680
21
23
24#include <xercesc/sax2/DefaultHandler.hpp>
25#include <xercesc/util/XMLUniDefs.hpp>
26
27
28namespace XALAN_CPP_NAMESPACE {
29
30
31
32using namespace xercesc;
33
34
35
36static const XMLCh s_transUnitXMLCh[] =
37{
38 chLatin_t,
39 chLatin_r,
40 chLatin_a,
41 chLatin_n,
42 chLatin_s,
43 chDash,
44 chLatin_u,
45 chLatin_n,
46 chLatin_i,
47 chLatin_t,
48
49 chNull
50};
51
52
53static const XMLCh s_sourceXMLCh[] =
54{
55 chLatin_s,
56 chLatin_o,
57 chLatin_u,
58 chLatin_r,
59 chLatin_c,
60 chLatin_e,
61
62 chNull
63};
64
65
66static const XMLCh s_targetXMLCh[] =
67{
68 chLatin_t,
69 chLatin_a,
70 chLatin_r,
71 chLatin_g,
72 chLatin_e,
73 chLatin_t,
74
75 chNull
76};
77
78
79static const XMLCh s_xmlLangXMLCh[] =
80{
81 chLatin_x,
82 chLatin_m,
83 chLatin_l,
84 chColon,
85 chLatin_l,
86 chLatin_a,
87 chLatin_n,
88 chLatin_g,
89 chNull
90};
91
92
93
94static const XMLCh s_idXMLCh[] =
95{
96 chLatin_i,
97 chLatin_d,
98 chNull
99};
100
101static const XMLCh s_textXMLCh[] =
102{
103 chLatin_T,
104 chLatin_e,
105 chLatin_x,
106 chLatin_t,
107 chNull
108};
109
110
111// Common class for the all system: creates index file ( common for all localization systems)
112// For creation data file responsible subclasses
113
114
115class SAX2Handler : public xercesc::DefaultHandler
116{
117public:
118 // -----------------------------------------------------------------------
119 // Constructors
120 // -----------------------------------------------------------------------
122 virtual ~SAX2Handler();
123
124public:
125
126 virtual void
128 const XMLCh* const uri,
129 const XMLCh* const localname,
130 const XMLCh* const qname,
131 const Attributes& attributes);
132
133 virtual void
135
136 virtual void
138
139 // -----------------------------------------------------------------------
140 // Implementations of the SAX ErrorHandler interface
141 // -----------------------------------------------------------------------
142 virtual void
144
145 virtual void
147
148 virtual void
150
151 void
152 setLocale(const char* localeName);
153
154 const XMLCh*
155 getLocale () const
156 {
157 return m_locale;
158 }
159
160protected:
161
162 bool
165 int iBufLen,
166 const char* szSource) const;
167
168 virtual void
170
171 virtual void
173
174 virtual void
176
177 virtual void
179
180 virtual void
182
183 void
185
186 void
188
189private:
190
191 void
192 createHeaderForIndexFile();
193
194 void
195 createBottomForIndexFile();
196
197 void
198 printBeginOfIndexLine();
199
200 void
201 printEndOfIndexLine();
202
203protected:
204
206
208
210
211 // -----------------------------------------------------------------------
212 // SAX2 Handler is responsible for creating index file, so keep
213 // index file FormatTarget as private data member
214 // -----------------------------------------------------------------------
215
216private:
217
218 MsgFileOutputStream m_indexOutputStream;
219
220 // Not implemented...
222 operator=(const SAX2Handler&);
223
224 SAX2Handler(const SAX2Handler&);
225
226 bool
227 operator==(const SAX2Handler&) const;
228};
229
230
231
232}
233
234
235
236#endif //SAX2HANDLER_1357924680
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
virtual void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attributes)
virtual void createHeaderForDataFile()=0
virtual ~SAX2Handler()
SAX2Handler(const char *indexFileName)
virtual void printToDataFile(const char *sArrayOfStrings[])=0
bool translateCharToXMLByteArray(XMLByte *buffer, int iBufLen, const char *szSource) const
virtual void fatalError(const SAXParseException &e)
virtual void endDocument()
const XMLCh * getLocale() const
virtual void createBottomForDataFile()=0
virtual void printBeginOfDataLine()=0
virtual void error(const SAXParseException &e)
virtual void warning(const SAXParseException &e)
void setLocale(const char *localeName)
virtual void printEndOfDataLine()=0
virtual void startDocument()
void printToIndexFile(const char *sArrayOfStrings[])
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)