in 2.04 use:
// create new xml file
bool CCUserDefault::createXMLFile()
{
bool bRet = false;
xmlDocPtr doc = NULL;
do
{
// new doc
doc = xmlNewDoc(BAD_CAST“1.0”);
if (doc NULL)
{
CCLOG(“can not create xml doc”);
break;
}
// new root node
xmlNodePtr rootNode = xmlNewNode(NULL, BAD\_CAST USERDEFAULT\_ROOT\_NAME);
if (rootNode NULL)
{
CCLOG (“can not create root node”);
break;
}
// set root node
xmlDocSetRootElement(doc, rootNode);
// save xml file
xmlSaveFile(m_sFilePath.c_str(), doc);
bRet = true;
} while (0);
// if doc is not null, free it
if (doc)
{
xmlFreeDoc(doc);
}
return bRet;
}
Why not use the 2.1 version of it in this way?