C ++ library for storing settings in XML

Before starting to write on my own settings library, I would try to find an existing one. I googled and found a lot for C # or MFC, but nothing that uses plain C ++ / STL. I would like something that allows you to access using keys such as:

mySettings["Root"]["Subsection"]["Value"].Value

Or something like that. Is there anything that can provide such an interface for an XML file, or do I have to minimize it myself?

Thanks J

+5
source share
3 answers

There is TinyXML and pugixml

PugiXML supports XPath

+7
source

Boost - , , . , , , - , :

:

// Create an empty property tree object
using boost::property_tree::ptree;
ptree pt;

// Load the XML file into the property tree. If reading fails
// (cannot open file, parse error), an exception is thrown.
read_xml(filename, pt);

// Get the filename and store it in the m_file variable.
// Note that we construct the path to the value by separating
// the individual keys with dots. If dots appear in the keys,
// a path type with a different separator can be used.
// If the debug.filename key is not found, an exception is thrown.
m_file = pt.get<std::string>("debug.filename");
+5

. , , ++ XML-API, XML, XML- - . , , . - , XML-. XML- . , /= bloatware.

0

All Articles