MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlParseNCName

Function xmlParseNCName

ThirdParty/libxml2/vtklibxml2/parser.c:3469–3514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3467 */
3468
3469static xmlHashedString
3470xmlParseNCName(xmlParserCtxtPtr ctxt) {
3471 const xmlChar *in, *e;
3472 xmlHashedString ret;
3473 size_t count = 0;
3474 size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
3475 XML_MAX_TEXT_LENGTH :
3476 XML_MAX_NAME_LENGTH;
3477
3478 ret.name = NULL;
3479
3480 /*
3481 * Accelerator for simple ASCII names
3482 */
3483 in = ctxt->input->cur;
3484 e = ctxt->input->end;
3485 if ((((*in >= 0x61) && (*in <= 0x7A)) ||
3486 ((*in >= 0x41) && (*in <= 0x5A)) ||
3487 (*in == '_')) && (in < e)) {
3488 in++;
3489 while ((((*in >= 0x61) && (*in <= 0x7A)) ||
3490 ((*in >= 0x41) && (*in <= 0x5A)) ||
3491 ((*in >= 0x30) && (*in <= 0x39)) ||
3492 (*in == '_') || (*in == '-') ||
3493 (*in == '.')) && (in < e))
3494 in++;
3495 if (in >= e)
3496 goto complex;
3497 if ((*in > 0) && (*in < 0x80)) {
3498 count = in - ctxt->input->cur;
3499 if (count > maxLength) {
3500 xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName");
3501 return(ret);
3502 }
3503 ret = xmlDictLookupHashed(ctxt->dict, ctxt->input->cur, count);
3504 ctxt->input->cur = in;
3505 ctxt->input->col += count;
3506 if (ret.name == NULL) {
3507 xmlErrMemory(ctxt);
3508 }
3509 return(ret);
3510 }
3511 }
3512complex:
3513 return(xmlParseNCNameComplex(ctxt));
3514}
3515
3516/**
3517 * xmlParseNameAndCompare:

Callers 1

xmlParseQNameHashedFunction · 0.85

Calls 4

xmlFatalErrFunction · 0.85
xmlDictLookupHashedFunction · 0.85
xmlErrMemoryFunction · 0.85
xmlParseNCNameComplexFunction · 0.85

Tested by

no test coverage detected