<?xml versin='1.0' encoding='UTF-8'?><root><student><name>xioaming</name><age>20</age></student></root>
假设从环境变量中读取到的请求字符串为xmlreq,并将之存到内存;
xmlDocPtr doc;
int xmlreq_len = 0;
xmlNodePtr root,first_node,second_node;
char *first_label_name;
char *second_label_name;
char *sec_label_content = NULL;
doc = xmlReadMemory(xmlreq,xmlreq_len,NULL,0);
root = xmlDocGetRootElement(doc);
first_node = root->children;
first_label_name = first_node->name;
second_node = first_node->next;
second_label_name = second_node->name;
sec_label_content = xmlNodeGetContent(second_node);
原文链接:/xml/297407.html