| 14 | "'load': '0.02'}"; |
| 15 | |
| 16 | int 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(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…