xml 文件的读取

读取xml文件。读取xml文件node名字为Scaling的值。先熟悉xml文件的结构。调用相应的函数。得到自己想要的数值。

 void LoadXml(const string _XMLFile,string _value)

{

            rapidxml::file<> fdoc(_XMLFile.c_str());
            rapidxml::xml_document<> doc;
            doc.parse<0>(fdoc.data());
            rapidxml::xml_node<>* root = doc.first_node();
            
            for (rapidxml::xml_node<>*node = root->first_node(); node != NULL; node = node->next_sibling())
            {

                char* nodeName = node->name();
                if (strcmp(nodeName, "Scaling") == 0)
                {
                    _value=node->value();
                }

            }

}

猜你喜欢

转载自blog.csdn.net/qq_37171545/article/details/86656336
今日推荐