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

Function test_getElementById

lib_acl/samples/xml/xml2/main.c:269–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269static ACL_XML_NODE *test_getElementById(ACL_XML *xml, const char *id)
270{
271 ACL_ITER iter1;
272 ACL_XML_NODE *node = acl_xml_getElementById(xml, id);
273
274 printf("--------------- acl_xml_getElementById ---------------\r\n");
275 if (node == NULL) {
276 printf(">>>id: %s not found\r\n", id);
277 return NULL;
278 }
279
280 printf("tag-> %s, text: %s\n", STR(node->ltag), STR(node->text));
281
282 /* ������ xml �������� */
283 acl_foreach(iter1, node->attr_list) {
284 ACL_XML_ATTR *attr = (ACL_XML_ATTR*) iter1.data;
285 printf("\tattr_name: %s, attr_value: %s\n",
286 STR(attr->name), STR(attr->value));
287 }
288
289 printf("----------- the id2_2's next node is ------------\n");
290
291 node = acl_xml_node_next(node);
292
293 if (node) {
294 printf("-------------- walk node ----------------\n");
295
296 /* ������ xml �������� */
297 acl_foreach(iter1, node->attr_list) {
298 ACL_XML_ATTR *attr = (ACL_XML_ATTR*) iter1.data;
299 printf("\tattr_name: %s, attr_value: %s\n",
300 STR(attr->name), STR(attr->value));
301 }
302
303 } else
304 printf("-------------- null node ----------------\n");
305
306 printf("Enter any key to continue ...\r\n");
307 getchar();
308
309 return node;
310}
311
312static void parse_xml_benchmark(int once, int max, const char *data)
313{

Callers 1

parse_xmlFunction · 0.70

Calls 3

acl_xml_getElementByIdFunction · 0.85
acl_xml_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…