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

Function test_getElementById

lib_acl/samples/xml/xml6/xml.c:381–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381static ACL_XML3_NODE *test_getElementById(ACL_XML3 *xml, const char *id)
382{
383 ACL_ITER iter1;
384 ACL_XML3_NODE *node = acl_xml3_getElementById(xml, id);
385
386 printf("--------------- acl_xml3_getElementById ---------------\r\n");
387 if (node == NULL) {
388 printf(">>>id: %s not found\r\n", id);
389 return NULL;
390 }
391
392 printf("tag-> %s, text: %s\n", node->ltag, node->text);
393
394 /* ������ xml �������� */
395 acl_foreach(iter1, node->attr_list) {
396 ACL_XML3_ATTR *attr = (ACL_XML3_ATTR*) iter1.data;
397 printf("\tattr_name: %s, attr_value: %s\n",
398 attr->name, attr->value);
399 }
400
401 printf("----------- the id2_2's next node is ------------\n");
402
403 node = acl_xml3_node_next(node);
404
405 if (node) {
406 printf("-------------- walk node ----------------\n");
407
408 /* ������ xml �������� */
409 acl_foreach(iter1, node->attr_list) {
410 ACL_XML3_ATTR *attr = (ACL_XML3_ATTR*) iter1.data;
411 printf("\tattr_name: %s, attr_value: %s\n",
412 attr->name, attr->value);
413 }
414
415 } else
416 printf("-------------- null node ----------------\n");
417
418 printf("Enter any key to continue ...\r\n");
419 getchar();
420
421 return node;
422}
423
424static ACL_XML3 *get_xml(char *data, const char* root, int multi_root)
425{

Callers 1

parse_xmlFunction · 0.70

Calls 3

acl_xml3_getElementByIdFunction · 0.85
acl_xml3_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…