<config>
<author>
<name>icefox</name>
<sex>female</sex>
<age>21</age>
</author>
<author>
<name>dante</name>
<sex>female</sex>
<age>22</age>
</author>
</config>
#include <iostream>
#include <tinyxml.h>
#include <tinystr.h>
#include <tinystr.cpp>
#include <tinyxml.cpp>
#include <tinyxmlerror.cpp>
#include <tinyxmlparser.cpp>
using namespace std;
int main()
{
TiXmlDocument xmlLoader;
xmlLoader.LoadFile("test.xml");
TiXmlNode * author;
for(author=xmlLoader.FirstChild()->FirstChild();author!=0;author=author->NextSibling())
{
TiXmlNode * tempNode;
for(tempNode = author->FirstChild();tempNode!=0;tempNode=tempNode->NextSibling())
{
cout<<tempNode->Value()<<":"<<tempNode->ToElement()->GetText()<<endl;
}
}
return 0;
}
这东西要靠自己一点一点摸索,有帮助文档嘛,一般就不用愁了,虽然是英文的,很容易懂.