Example #1
0
int XMLLanguages::GetPrevItem(int curid)
{
    TiXmlElement* root = m_xmlDocument.RootElement();
    int id = -1;
    if(root)
    {
        TiXmlElement* child;
        for(child=root->FirstChildElement();child;child=child->NextSiblingElement())
        {
            if(strcmp(child->Value(), "item") == 0 && i2str(curid) == child->Attribute("id"))
            {
                child = child->PreviousSibling()->ToElement();
                if(child)
                    return str2i(child->Attribute("id"));
                else
                    break;
            }
        }
    }
    return id;
}