示例#1
0
    <file name=\"debug.log\"/> \
    <modules type=\"internal\">  \
        <module>Finance_Internal</module> \
        <module>Admin_Internal</module>  \
        <module>HR_Internal</module>  \
    </modules> \
</root>";

    Xml  xml;
    xml.paserFromString(xml_str);
    //name = rootname
    std::cout << xml.get<std::string>("root.<xmlattr>.name", "empty....") << std::endl;
    //name = debug.log
    std::cout << xml.get<std::string>("root.file.<xmlattr>.name", "empty....") << std::endl;

    auto modules = xml.getChild("root.modules");
    if(modules)
    {
        for( auto& m : modules.get() )
        {
            if( m.first != "<xmlattr>" )
            {   //<module>Finance_Internal</module>
                std::cout << "root.modules = " << m.first << "  " << m.second.get_value<std::string>() << std::endl;
            }
        }
    }
}

void test_rand()
{
    //默认int