RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
tinyxml第二课文件读取-创新互联



 
  
   
    
    
   

  

 

10年积累的网站制作、网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站制作后付款的网站建设流程,更有清徐免费网站建设让你可以放心的选择与我们合作。

代码

void IterChannelNode(const TiXmlNode* nodeUnit, std::vector &vecChannelInfo)
{
 const TiXmlNode* nodeChannelIter = NULL;
 nodeChannelIter = nodeUnit->IterateChildren("Channel", nodeChannelIter);

 do
 {
  if (NULL == nodeChannelIter) break;

  std::string strName = nodeChannelIter->ToElement()->Attribute("name");

  struChannelInfo channelInfo;
  channelInfo.strChannelId = nodeChannelIter->ToElement()->Attribute("id");
  channelInfo.strChannelName = nodeChannelIter->ToElement()->Attribute("name");
  vecChannelInfo.push_back(channelInfo);
  nodeChannelIter = nodeChannelIter->NextSibling();
 } while (1);
}

void IterUnitNode(const TiXmlNode* nodeDevice, std::vector &vecChannelInfo)
{
 const TiXmlNode* nodeUnitIter = NULL;
 nodeUnitIter = nodeDevice->IterateChildren("UnitNodes", nodeUnitIter);
 do
 {
  if (NULL == nodeUnitIter) break;

  IterChannelNode(nodeUnitIter, vecChannelInfo);
  nodeUnitIter = nodeUnitIter->NextSibling();
 } while (1);
}

int IterDeviceInfo(const std::string &strXML, std::vector &vecChannelInfo)
{
 if (strXML.empty()) return -1;

 TiXmlDocument doc;
 doc.LoadFile(strXML.c_str());

 TiXmlElement* root = doc.FirstChildElement();
 if (NULL == root) return -1;

 const TiXmlNode* nodeDevices = NULL;
 nodeDevices = root->IterateChildren("Devices", nodeDevices);
 if (NULL == nodeDevices) return -1;


 const TiXmlNode* nodeDevice = NULL;
 nodeDevice = nodeDevices->IterateChildren("Device", nodeDevice);

 do
 {
  if (NULL == nodeDevice) break;
  //访问第一个节点
  std::string strTypeId = nodeDevice->ToElement()->Attribute("type");
  std::cout << strTypeId << std::endl;
  IterUnitNode(nodeDevice, vecChannelInfo);
  nodeDevice = nodeDevice->NextSibling();

 } while (1);

 return 0;
}

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:tinyxml第二课文件读取-创新互联
网站链接:http://scyingshan.cn/article/esdjh.html