28 #include <libxml/parserInternals.h>
46 DEBTRACE(
"Problem with parser: final stack level should be 0 and not " <<
_level);
59 DEBTRACE(
"parser::SetUserDataAndPush, stack size: " << sp.size());
93 _counts=
new std::map<std::string,int>;
102 if((*_counts).find(el)==(*_counts).end())
105 (*
_counts)[el]=(*_counts)[el]+1;
110 if(
_orders.count(el)==0)
return;
113 std::string msg=
"unexpected "+el+
" element (wrong order)";
127 std::stringstream msg;
128 msg <<
"unexpected "+name+
" element (count="<<(*_counts)[name];
129 msg <<
" > maxOccurs=" << max <<
")";
138 std::stringstream msg;
139 msg<<
"expected "+name+
" element (count="<<(*_counts)[name];
140 msg <<
" < minOccurs=" << min <<
")";
149 while (names[i]!=
"")
151 ncount=ncount+(*_counts)[names[
i]];
156 std::stringstream msg;
157 msg<<
"unexpected "+el+
" element (choice count="<<ncount<<
" > maxOccurs=" << max <<
")";
166 while (names[i]!=
"")
168 ncount=ncount+(*_counts)[names[
i]];
173 std::stringstream msg;
174 msg <<
"expected element ";
176 while (names[i]!=
"")
178 msg << names[
i] <<
",";
181 msg <<
"(choice count="<<ncount<<
" < minOccurs=" << min <<
")";
188 for (
int i = 0; attr[
i];
i += 2)
190 if(name == std::string(attr[
i]))
return;
199 for (
int i = 0; attr[
i];
i += 2)
207 DEBTRACE(
"parser::onStart: " << el );
222 ctxt->userData = par;
241 DEBTRACE(
"parser::start_element " << name);
263 DEBTRACE(
"parser::characters " << len);
269 const xmlChar* value)
276 const xmlChar* value,
285 const char* fmt, ...)
291 std::string format =
"%s";
295 parv = va_arg(args,
char*);
298 else std::cerr << __FILE__ <<
" [" << __LINE__ <<
"] : "
299 <<
"error format not taken into account: " << fmt << std::endl;
304 const char* fmt, ...)
310 std::string format =
"%s";
314 parv = va_arg(args,
char*);
317 else std::cerr << __FILE__ <<
" [" << __LINE__ <<
"] : "
318 <<
"error format not taken into account: " << fmt << std::endl;
323 const char* fmt, ...)
329 std::string format =
"%s";
333 parv = va_arg(args,
char*);
336 else std::cerr << __FILE__ <<
" [" << __LINE__ <<
"] : "
337 <<
"error format not taken into account: " << fmt << std::endl;