34 #include <libxml/parserInternals.h>
40 ctxt->userData = parser;
81 currentParser->
onStart(aName, p);
94 _garbage.push_back(_stackParser.top());
95 DEBTRACE(
"xmlParserBase::end_element " << _garbage.size());
97 XML_SetUserData(_xmlParser, _stackParser.top());
98 childParser->
onEnd(aName);
114 string data((
char*)ch,len);
123 const xmlChar* value)
134 const char* fmt, ...)
140 string format =
"%s";
144 parv = va_arg(args,
char*);
147 else cerr << __FILE__ <<
" [" << __LINE__ <<
"] : "
148 <<
"error format not taken into account: " << fmt << endl;
157 const char* fmt, ...)
163 string format =
"%s";
167 parv = va_arg(args,
char*);
172 else cerr << __FILE__ <<
" [" << __LINE__ <<
"] : "
173 <<
"error format not taken into account: " << fmt << endl;
182 const char* fmt, ...)
184 DEBTRACE(
"xmlParserBase::fatal_error");
188 string format =
"%s";
192 parv = va_arg(args,
char*);
195 else cerr << __FILE__ <<
" [" << __LINE__ <<
"] : "
196 <<
"error format not taken into account: " << fmt << endl;
205 const xmlChar* value,
210 string data((
char*)value,len);
216 while (!_garbage.empty())
218 delete (_garbage.front());
219 _garbage.pop_front();
231 string attributeName = (
char*)*p;
234 string attributeValue = (
char*)*p;
237 _mapAttrib[attributeName] = attributeValue;
247 _mapAttrib[key] = value;
256 if (_mapAttrib.find(key) == _mapAttrib.end())
258 string what =
"Attribute does not exist: " + key;
261 return _mapAttrib[key];
309 if(counts.find(elem)==counts.end())
312 counts[elem]=counts[elem]+1;
327 xmlStopParser(_xmlParser);
349 xmlSAXHandler baseHandler =
383 saxContext = xmlCreateFileParserCtxt(xmlFile.c_str());
387 string what =
"problem while trying to open the file for parsing " + xmlFile;
390 xmlSAXHandlerPtr old_sax = saxContext->sax;
391 saxContext->sax = &baseHandler;
395 xmlParseDocument(saxContext);
397 if ( saxContext->myDoc != NULL ) {
398 xmlFreeDoc( saxContext->myDoc );
399 saxContext->myDoc = NULL;
401 if ( saxContext != NULL ) {
402 saxContext->sax = old_sax;
403 xmlFreeParserCtxt( saxContext );