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

Function main

lib_acl_cpp/samples/xml/xml3/main.cpp:16–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 "'load': '0.02'}";
15
16int main(void)
17{
18 acl::json json;
19 json.update(data);
20
21 // �� JSON ����תΪ XML ���ݵĹ���
22
23 acl::xml1 xml;
24 acl::xml_node& server_node = xml.create_node("server");
25 xml.get_root().add_child(server_node);
26
27 acl::string key;
28 acl::json_node& root = json.get_root();
29 acl::json_node* child = root.first_child();
30
31 while (child != NULL)
32 {
33 const char* name = child->tag_name();
34 if (name == NULL || *name == 0)
35 {
36 child = root.next_child();
37 continue;
38 }
39
40 if (strcasecmp(name, "server") != 0)
41 {
42 const char* value = child->get_text();
43 if (value != NULL)
44 {
45 if (strcasecmp(name, "addr") == 0)
46 key = value;
47 server_node.add_attr(name, value);
48 }
49
50 child = root.next_child();
51 continue;
52 }
53
54 acl::json_node* server = child->get_obj();
55 if (server == NULL)
56 {
57 child = root.next_child();
58 continue;
59 }
60
61
62 acl::json_node* proc = server->first_child();
63
64 while (proc != NULL)
65 {
66 // ���� proc XML ���
67 acl::xml_node& proc_node = xml.create_node("proc");
68 server_node.add_child(proc_node);
69
70 acl::json_node* status = proc->first_child();
71 while (status != NULL)
72 {
73 const char* tag = status->tag_name();

Callers

nothing calls this directly

Calls 9

get_textMethod · 0.80
get_objMethod · 0.80
updateMethod · 0.45
create_nodeMethod · 0.45
first_childMethod · 0.45
tag_nameMethod · 0.45
next_childMethod · 0.45
build_xmlMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…