MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_xml_parse

Function my_xml_parse

strings/xml.c:325–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323
324
325int my_xml_parse(MY_XML_PARSER *p,const char *str, size_t len)
326{
327
328 my_xml_attr_rewind(p);
329
330 p->beg=str;
331 p->cur=str;
332 p->end=str+len;
333
334 while ( p->cur < p->end )
335 {
336 MY_XML_ATTR a;
337 if (p->cur[0] == '<')
338 {
339 int lex;
340 int question=0;
341 int exclam=0;
342
343 lex=my_xml_scan(p,&a);
344
345 if (MY_XML_COMMENT == lex)
346 continue;
347
348 if (lex == MY_XML_CDATA)
349 {
350 a.beg+= 9;
351 a.end-= 3;
352 my_xml_value(p, a.beg, (size_t) (a.end-a.beg));
353 continue;
354 }
355
356 lex=my_xml_scan(p,&a);
357
358 if (MY_XML_SLASH == lex)
359 {
360 if (MY_XML_IDENT != (lex=my_xml_scan(p,&a)))
361 {
362 sprintf(p->errstr,"%s unexpected (ident wanted)",lex2str(lex));
363 return MY_XML_ERROR;
364 }
365 if (MY_XML_OK != my_xml_leave(p,a.beg,(size_t) (a.end-a.beg)))
366 return MY_XML_ERROR;
367 lex=my_xml_scan(p,&a);
368 goto gt;
369 }
370
371 if (MY_XML_EXCLAM == lex)
372 {
373 lex=my_xml_scan(p,&a);
374 exclam=1;
375 }
376 else if (MY_XML_QUESTION == lex)
377 {
378 lex=my_xml_scan(p,&a);
379 question=1;
380 }
381
382 if (MY_XML_IDENT == lex)

Callers 3

my_parse_charset_xmlFunction · 0.85
parse_xmlMethod · 0.85
mainFunction · 0.85

Calls 7

my_xml_attr_rewindFunction · 0.85
my_xml_scanFunction · 0.85
my_xml_valueFunction · 0.85
lex2strFunction · 0.85
my_xml_leaveFunction · 0.85
my_xml_enterFunction · 0.85
my_xml_norm_textFunction · 0.85

Tested by 1

mainFunction · 0.68