See here for details on how to make a case insensitive string type:

http://www.gotw.ca/gotw/029.htm

You can then specialise the property tree with this new type:

typedef basic_ptree< ci_string, std::string > ptree;

You can also use boost::iequals for comparing strings ignoring case, which may or may not be a better solution depending on your requirements.
Regards
Dan
2012/2/7 Brad Tilley <kj4eit@gmail.com>
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 mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users