Пример #1
0
bool get_attr
    (xml::element const& element
    ,std::string const&  name
    ,std::string&        value
    )
{
    try
        {
        xml::attributes const& attrs = element.get_attributes();
        xml::attributes::const_iterator i = attrs.find(name.c_str());
        if(i != attrs.end())
            {
            value = i->get_value();
            return true;
            }
        else
            {
            return false;
            }
        }
    catch(std::exception const& e)
        {
        fatal_error() << e.what() << LMI_FLUSH;
        throw "Unreachable--silences a compiler diagnostic.";
        }
}
Пример #2
0
void set_attr
    (xml::element&      element
    ,std::string const& name
    ,std::string const& value
    )
{
    try
        {
        element.get_attributes().insert(name.c_str(), value.c_str());
        }
    catch(std::exception const& e)
        {
        fatal_error() << e.what() << LMI_FLUSH;
        throw "Unreachable--silences a compiler diagnostic.";
        }
}