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

Function test_getElementById

lib_acl/samples/xml/xml3/xml.c:402–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402static ACL_XML2_NODE *test_getElementById(ACL_XML2 *xml, const char *id)
403{
404 ACL_ITER iter1;
405 ACL_XML2_NODE *node = acl_xml2_getElementById(xml, id);
406
407 printf("--------------- acl_xml2_getElementById ---------------\r\n");
408 if (node == NULL) {
409 printf(">>>id: %s not found\r\n", id);
410 return NULL;
411 }
412
413 printf("tag-> %s, text: %s\n", node->ltag, node->text);
414
415 /* ������ xml �������� */
416 acl_foreach(iter1, node->attr_list) {
417 ACL_XML2_ATTR *attr = (ACL_XML2_ATTR*) iter1.data;
418 printf("\tattr_name: %s, attr_value: %s\n",
419 attr->name, attr->value);
420 }
421
422 printf("----------- the id2_2's next node is ------------\n");
423
424 node = acl_xml2_node_next(node);
425
426 if (node) {
427 printf("-------------- walk node ----------------\n");
428
429 /* ������ xml �������� */
430 acl_foreach(iter1, node->attr_list) {
431 ACL_XML2_ATTR *attr = (ACL_XML2_ATTR*) iter1.data;
432 printf("\tattr_name: %s, attr_value: %s\n",
433 attr->name, attr->value);
434 }
435
436 } else
437 printf("-------------- null node ----------------\n");
438
439 printf("Enter any key to continue ...\r\n");
440 getchar();
441
442 return node;
443}
444
445static ACL_XML2 *get_xml(int once, const char *data,
446 const char* root, int multi_root)

Callers 1

parse_xmlFunction · 0.70

Calls 3

acl_xml2_getElementByIdFunction · 0.85
acl_xml2_node_nextFunction · 0.85
acl_foreachFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…