Technical points:
1. Basic XML Parsing library: TinyXML
2, Xmltree class
3. Overload [], Return Xmltree class
4. Implement the Count function to return the number of this level of directory child nodes
For the following cmystring Strrequestxml: (in order to illustrate the function, the request node is divided into two parts written)
<?xml version= ' 1.0 ' encoding= ' utf-8 '? ><request Version = ' 1.0 ' name = ' Updatemainview ' ><request>< Requesttype>updateui</requesttype><view><viewtype>mainview</viewtype><viewid> View_1</viewid><event>click</event><listview><id>listview_mainview</id> <selectedId>item_2</selectedId></listView></view></request>
can achieve:
1. Implement string-based constructors: XmlTree *requestxml = new XmlTree (strrequestxml);
2. Overload [] Implements sub-object array of child XmlTree: XmlTree **subviewrequestxml = requestxml["Request"][1]["view"];
3, the realization when Xmltree only one node can be strong to turn into cmystring:requestxml["request"][1]["View" ["Event"]. CMyString (), and can be get/set and directly assigned
4, the implementation of the number of sub-nodes count:requestxml["request"][1]. Count () = = 2
5. Node access for non-tree representations: reuestxml["Request"][0]["version"] = = "1.0"
6, extension implementation, you can consider the extension: Xmltree insert and delete: requestxml["View"].insert (Subviewrequestxml)
A secondary pointer represents the first element of a primary pointer array that can be turned around, no problem, just like a two-dimensional array arrayxy[][] Arrayxy = = Arrayxy[0];
So the above xmltree **subviewrequestxml = requestxml["Request"][0]["view"];
Can be written as XmlTree *subviewrequestxml = requestxml["Request"][0]["view"]; Can also be written as xmltree *subviewrequestxml = requestxml["Request" ["View"];
An easy-to-manipulate XML parsing package (c + +) based on simple recursive thinking