Used to do in the beginning has been useless tinyxml, on-line search said rapidxml efficiency than tinyxml high. Individuals prefer the pursuit of efficiency, so they could not help but try to use Rapidxml. Rapidxml's official website is as follows: http://rapidxml.sourceforge.net/manual.html.
Rapidxml is an XML DOM parsing toolkit written in C + + that contains the entire parsing toolkit in a header file so that time is not compiled or connected. Just include the three header files in the Rapidxml. Rapidxml is trying to be the fastest XML DOM parsing toolkit, while ensuring the availability, portability, and compatibility of the results with the standards. When you manipulate the same data, the parsing speed is close to the strlen () function. the following is a common XML library efficiency comparison table provided by Rapidxml, which also provides an efficient comparison of the strlen () functions with a bull nose. If other users provide non-personal comparative data:
Second, simple use
include the necessary header files
#include "rapidxml.hpp"
Create a Document Object
rapidxml::xml_document<char> Doc;
parsing an XML string that requires the end of '% '
std::string str (...);
doc.parse<0> (Const_cast<char *> (Str.c_str ()));
Get node
rapidxml::xml_node<char> * node = Doc.first_node ("node name");
Traverse all nodes
For (rapidxml::xml_node<char> * node = Parent_node->first_node ("node name");
node! = NULL;
node = node->next_sibling ())
{
...
}
Comparison of TINYXML and rapidxml efficiency