Disclaimer: Anyone and organizations are welcome to repost this blogArticleBut the original link and author information must be marked.
Link to this article:Http://blog.csdn.net/li_007/archive/2009/03/30/4037213.aspx
Pioneering little turtle -------> csdnBit by bitBlog
Some time ago, I needed to use C ++ to write a console for reading, writing, and parsing XML.ProgramIt is impossible to think about writing it by yourself. For this reason, I went to opensourece's stuff. Google found many libraries using Parser XML, finally, I learned about tinyxml and xerces, the famous Lib. xerces is a heavyweight Library contributed by IBM, while tinyxml is a very small XML parsing library, tinyxml is suitable for my needs, but it should be noted that tinyxml does not have the verification function. In this way, I need to perform a lot of verification to ensure the correctness of XML and increase the workload of programer, however, it is sufficient to deal with some configuration files and other functions that are easy to use.Code, Around 6000 lines of code, it is very convenient to serve us in the form of a static library.
Tinyxml contains the following classes:
It's easy. There are several classes. The functions of each class are as follows:
Here, tinyxml is based on Dom, so all data is stored in the memory, which facilitates reading and writing, and is not convenient to implement functions such as tixmlprinter, instead of sending an event to generate data as expected in Sax.