-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·37 lines (33 loc) · 1.02 KB
/
Copy pathmain.cpp
File metadata and controls
executable file
·37 lines (33 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copy: Copyright (C),2020-2020, FlyWant Tech. Co., Ltd.
* Description: main entry.
* Author: zhouhaifeng
* Date: 2020-03-07
*/
#include <libxml/parser.h>
#include <iostream>
#include <unistd.h>
int main()
{
const char* fileName = "/opt/source/xmlbenchmark/try.xml";
xmlDocPtr doc = xmlParseFile(fileName);
xmlNodePtr root = xmlDocGetRootElement(doc);
std::cout << "root name:" << root->name << std::endl;
xmlNodePtr templateNodePtr = root->children;
while (templateNodePtr != nullptr) {
if (templateNodePtr->type != XML_ELEMENT_NODE) {
std::cout << "it does not element node <<" << templateNodePtr->type << std::endl;
templateNodePtr = templateNodePtr->next;
continue;
}
if (xmlStrcmp(templateNodePtr->name, BAD_CAST("template")) != 0) {
std::cout << "it does not template node <<" << templateNodePtr->name << std::endl;
templateNodePtr = templateNodePtr->next;
continue;
}
templateNodePtr = templateNodePtr->next;
}
sleep(60);
xmlFreeDoc(doc);
return 0;
}