MCPcopy Create free account
hub / github.com/acl-dev/acl / xml_parse_attr_val

Function xml_parse_attr_val

lib_acl/src/xml/acl_xml_parse.c:536–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536static const char *xml_parse_attr_val(ACL_XML *xml, const char *data)
537{
538 int ch;
539 ACL_XML_ATTR *attr = xml->curr_node->curr_attr;
540
541 if (LEN(attr->value) == 0 && !attr->quote) {
542 SKIP_SPACE(data);
543 if (IS_QUOTE(*data))
544 attr->quote = *data++;
545 }
546
547 if (*data == 0)
548 return data;
549
550 while ((ch = *data) != 0) {
551 data++;
552
553 if (attr->quote) {
554 if (ch == attr->quote) {
555 xml->curr_node->status = ACL_XML_S_ATTR;
556 xml->curr_node->last_ch = ch;
557 break;
558 }
559 ADDCH(attr->value, ch);
560 xml->curr_node->last_ch = ch;
561 } else if (ch == '>') {
562 xml_parse_check_self_closed(xml);
563
564 if ((xml->curr_node->flag & ACL_XML_F_SELF_CL)
565 && xml->curr_node->last_ch == '/')
566 {
567 acl_vstring_truncate(attr->value,
568 LEN(attr->value) - 1);
569 xml->curr_node->status = ACL_XML_S_RGT;
570 } else
571 xml->curr_node->status = ACL_XML_S_LGT;
572 break;
573 } else if (IS_SPACE(ch)) {
574 xml->curr_node->status = ACL_XML_S_ATTR;
575 xml->curr_node->last_ch = ch;
576 break;
577 } else {
578 ADDCH(attr->value, ch);
579 xml->curr_node->last_ch = ch;
580 }
581 }
582
583 ACL_VSTRING_TERMINATE(attr->value);
584
585 if (xml->curr_node->status != ACL_XML_S_AVAL) {
586 if (LEN(attr->value) > 0 && xml->decode_buf != NULL) {
587 ACL_VSTRING_RESET(xml->decode_buf);
588 acl_xml_decode(STR(attr->value), xml->decode_buf);
589 if (LEN(xml->decode_buf) > 0)
590 STRCPY(attr->value, STR(xml->decode_buf));
591 }
592
593 /* ���ñ�ǩID��ӳ������ϣ���У��Ա��ڿ��ٲ�ѯ */

Callers

nothing calls this directly

Calls 5

acl_vstring_truncateFunction · 0.85
acl_xml_decodeFunction · 0.85
acl_htable_findFunction · 0.85
acl_htable_enterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…