3#include <boost/shared_ptr.hpp>
4#include <libxml++/libxml++.h>
19 if (
node.isObject()) {
24 for (
int n = 0; n <
members.size(); ++n) {
26 if (
node[name].isNull()) {
27 ss << indent <<
"<" << name <<
"/>\n";
33 ss << indent <<
"<" << name <<
">";
39 ss <<
"</" << name <<
">\n";
41 }
else if (
node.isArray()) {
44 indent = indent.substr(0, indent.size() - 2);
47 if (
node[n].isNull()) {
64 }
else if (
node.isString()) {
66 }
else if (
node.isInt()) {
68 }
else if (
node.isUInt()) {
70 }
else if (
node.isDouble()) {
72 }
else if (
node.isBool()) {
83 using std::stringstream;
93 string msg =
"Failed to parse JSON file into XML:\n" + \
94 reader.getFormattedErrorMessages();
107 if (
node.isMember(key)) {
108 if (
node[key].isArray()) {
126 int n =
xnode->NElements();
127 for (
int i = 0; i < n; ++i) {
128 string name =
xnode->GetElementName(i);
133 val = Value(
subxnode->GetString(
"."));
148 using std::stringstream;
151 boost::shared_ptr<XMLParser>
parser = boost::shared_ptr<XMLParser>(
156 string rootname =
parser->Document()->get_root_node()->get_name();
Writes a Value in JSON format with custom formatting.
Unserialize a JSON document into a Value.
bool parse(const std::string &document, Value &root, bool collectComments=true)
Read a Value from a JSON document.
Value & append(const Value &value)
Append value to array at the end.
A class for extracting information from a given XML parser.
InfileTree * SubTree(std::string query, int index=0)
populates a child infile based on a query and index
For validating files received via IO.
For values that are too big, too small, etc.
A helper class to hold xml file data and provide automatic validation.
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters