分类: 其他平台
2013-02-28 12:12:32
TiXmlDocument xmlDoc( splitRuleTable.c_str() );
if(!xmlDoc.LoadFile())
{
return false;
}
TiXmlElement *pRootNode = xmlDoc.RootElement();
if(pRootNode == NULL)
{
return false;
}
TiXmlElement *pCurRecord = pRootNode->FirstChildElement();
while(pCurRecord)
{
CRuleTable cTable;
CTailIpPort::vctIpPort vctIpPortPool;
TiXmlElement *pTableEnVal = pCurRecord->FirstChildElement("TableEnVal");
string strTableEnVal = pTableEnVal->FirstChild()->Value();
int32 nIsTailSplit = 0 ;
pTableEnVal->QueryIntAttribute("IsTailSplit", &nIsTailSplit);
pTableEnVal->QueryIntAttribute("SplitType", &cTable.m_nTailFieldEnumVal);
cTable.m_nIsTailSplit = (int16)nIsTailSplit;
TiXmlElement *pTailNum = pCurRecord->FirstChildElement("TailNumber");
string strTailNum = pTailNum->FirstChild()->Value();
TiXmlElement *pIpList = pCurRecord->FirstChildElement("IPPortList");
TiXmlElement * pConnet = pIpList->FirstChildElement("Connect");
for(;pConnet; pConnet = pConnet->NextSiblingElement())
{
CIpPort cIpPort;
cIpPort.m_strIp = pConnet->Attribute("ip");
pConnet->QueryIntAttribute("port", &cIpPort.m_nPort);
vctIpPortPool.push_back(cIpPort);
}
pCurRecord = pRootNode->NextSiblingElement();
}