Ejemplo n.º 1
0
std::string get_content(xml::element const& element)
{
    try
        {
        std::string s;
        typedef xml::node::const_iterator NodeConstIterator;
        for(NodeConstIterator i = element.begin(); i != element.end(); ++i)
            {
            if(i->is_text())
                {
                char const* content = i->get_content();
                if(content)
                    {
                    s += i->get_content();
                    }
                }
            }
        return s;
        }
    catch(std::exception const& e)
        {
        fatal_error() << e.what() << LMI_FLUSH;
        throw "Unreachable--silences a compiler diagnostic.";
        }
}
Ejemplo n.º 2
0
xml::node::const_iterator retrieve_element
    (xml::element const& parent
    ,std::string  const& name
    )
{
    xml::node::const_iterator i = parent.find(name.c_str());
    if(parent.end() == i)
        {
        fatal_error()
            << "Required element '"
            << name
            << "' not found."
            << LMI_FLUSH
            ;
        }
    return i;
}