26 #include <xercesc/util/PlatformUtils.hpp> 27 #include <xercesc/sax2/SAX2XMLReader.hpp> 28 #include <xercesc/sax2/Attributes.hpp> 39 IsisXMLParameter::IsisXMLParameter(
char *PencodingName,
40 bool &PexpandNamespaces,
41 XERCES::SAX2XMLReader* &Pparser,
44 encodingName = PencodingName;
45 expandNamespaces = PexpandNamespaces;
47 parameter = Pparameter;
49 prevDocHandler = parser->getContentHandler();
50 prevErrorHandler = parser->getErrorHandler();
52 parser->setContentHandler(
this);
53 parser->setErrorHandler(
this);
55 generalHandler = NULL;
56 multipleValuesHandler = NULL;
59 helpersHandler = NULL;
62 IsisXMLParameter::~IsisXMLParameter() {
63 if(generalHandler != NULL) {
64 delete generalHandler;
65 generalHandler = NULL;
67 if(multipleValuesHandler != NULL) {
68 delete multipleValuesHandler;
69 multipleValuesHandler = NULL;
71 if(ignoreHandler != NULL) {
75 if(listHandler != NULL) {
79 if(helpersHandler != NULL) {
80 delete helpersHandler;
81 helpersHandler = NULL;
87 void IsisXMLParameter::characters(
const XMLCh *
const chars,
88 const XMLSize_t length) {}
91 void IsisXMLParameter::endElement(
const XMLCh *
const uri,
92 const XMLCh *
const localname,
93 const XMLCh *
const qname) {
94 if((
string)XERCES::XMLString::transcode(localname) !=
"list") {
95 parser->setContentHandler(prevDocHandler);
96 parser->setErrorHandler(prevErrorHandler);
100 void IsisXMLParameter::startElement(
const XMLCh *
const uri,
101 const XMLCh *
const localname,
102 const XMLCh *
const qname,
103 const XERCES::Attributes &attributes) {
104 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"type") {
105 if(generalHandler != NULL) {
106 delete generalHandler;
107 generalHandler = NULL;
109 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
110 parser, ¶meter->type);
112 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"brief") {
113 if(generalHandler != NULL) {
114 delete generalHandler;
115 generalHandler = NULL;
117 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
118 parser, ¶meter->brief);
120 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"description") {
121 if(generalHandler != NULL) {
122 delete generalHandler;
123 generalHandler = NULL;
125 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
126 parser, ¶meter->description);
128 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"default") {
129 if(multipleValuesHandler != NULL) {
130 delete multipleValuesHandler;
131 multipleValuesHandler = NULL;
134 parser, ¶meter->defaultValues);
136 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"internalDefault") {
137 if(generalHandler != NULL) {
138 delete generalHandler;
139 generalHandler = NULL;
141 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser,
142 ¶meter->internalDefault);
144 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"count") {
145 if(generalHandler != NULL) {
146 delete generalHandler;
147 generalHandler = NULL;
149 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser,
152 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"list") {
154 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"option") {
155 if(listHandler != NULL) {
159 unsigned int index = parameter->listOptions.size();
160 parameter->listOptions.resize(index + 1);
161 QString lo = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
163 parameter->listOptions[index].value = lo;
164 listHandler =
new IsisXMLList(encodingName, expandNamespaces, parser,
165 ¶meter->listOptions[index]);
167 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"minimum") {
168 if(generalHandler != NULL) {
169 delete generalHandler;
170 generalHandler = NULL;
172 QString mi = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
173 parameter->minimum_inclusive = mi.toLower();
174 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
175 parser, ¶meter->minimum);
177 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"maximum") {
178 if(generalHandler != NULL) {
179 delete generalHandler;
180 generalHandler = NULL;
182 QString mi = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
183 parameter->maximum_inclusive = mi.toLower();
184 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser,
185 ¶meter->maximum);
187 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"greaterThan") {
188 if(multipleValuesHandler != NULL) {
189 delete multipleValuesHandler;
190 multipleValuesHandler = NULL;
193 parser, ¶meter->greaterThan);
195 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"greaterThanOrEqual") {
196 if(multipleValuesHandler != NULL) {
197 delete multipleValuesHandler;
198 multipleValuesHandler = NULL;
201 parser, ¶meter->greaterThanOrEqual);
203 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"lessThan") {
204 if(multipleValuesHandler != NULL) {
205 delete multipleValuesHandler;
206 multipleValuesHandler = NULL;
209 parser, ¶meter->lessThan);
211 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"lessThanOrEqual") {
212 if(multipleValuesHandler != NULL) {
213 delete multipleValuesHandler;
214 multipleValuesHandler = NULL;
217 parser, ¶meter->lessThanOrEqual);
219 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"notEqual") {
220 if(multipleValuesHandler != NULL) {
221 delete multipleValuesHandler;
222 multipleValuesHandler = NULL;
225 parser, ¶meter->notEqual);
227 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"odd") {
228 if(generalHandler != NULL) {
229 delete generalHandler;
230 generalHandler = NULL;
232 parameter->odd =
"TRUE";
233 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser);
236 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"exclusions") {
237 if(multipleValuesHandler != NULL) {
238 delete multipleValuesHandler;
239 multipleValuesHandler = NULL;
242 parser, ¶meter->exclude);
244 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"inclusions") {
245 if(multipleValuesHandler != NULL) {
246 delete multipleValuesHandler;
247 multipleValuesHandler = NULL;
250 parser, ¶meter->include);
252 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"filter") {
253 if(generalHandler != NULL) {
254 delete generalHandler;
255 generalHandler = NULL;
257 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser, ¶meter->filter);
259 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"defaultPath") {
260 if(generalHandler != NULL) {
261 delete generalHandler;
262 generalHandler = NULL;
264 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser,
267 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"fileMode") {
268 if(generalHandler != NULL) {
269 delete generalHandler;
270 generalHandler = NULL;
272 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser, ¶meter->fileMode);
274 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"pixelType") {
275 if(generalHandler != NULL) {
276 delete generalHandler;
277 generalHandler = NULL;
279 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces, parser, ¶meter->pixelType);
281 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"helpers") {
282 if(helpersHandler != NULL) {
283 delete helpersHandler;
284 helpersHandler = NULL;
286 helpersHandler =
new IsisXMLHelpers(encodingName, expandNamespaces, parser,
287 ¶meter->helpers);
290 if(ignoreHandler != NULL) {
291 delete ignoreHandler;
292 ignoreHandler = NULL;
294 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
295 (
string)XERCES::XMLString::transcode(localname));
Namespace for the standard library.