Boost logo

Boost Users :

Subject: [Boost-users] property tree case sensitivity
From: Brad Tilley (kj4eit_at_[hidden])
Date: 2012-02-07 16:10:43


I'm trying to make all of the strings (xml tags and attributes)
contained within a property tree be case insensitive, to make
comparison easy and consistent.

Here's an example:

boost::property_tree::iptree pt;
read_xml( file, pt,
boost::property_tree::xml_parser::trim_whitespace );

// case insensitive
std::string name = v.second.get<std::string>("<xmlattr>.nAmE");

// case insensitive
BOOST_FOREACH( boost::property_tree::iptree::value_type const& v,
pt.get_child("neTwOrK") )
{
    // fails comparison because "thing" is case sensitive.
    if ( v.first == "tHiNg" )
    {
        ....
    }
}

Is it possible to make v.first case insensitive as well?

Thanks,

Brad


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net