The way of yaml parsing? (yaml-cpp) -
i've made yaml file below.
define1: &define1 0: 0 1: 1 define2: <<: *define1 2: 2
and tried in online yaml parser. result below. ( how nodes constructed. )
{ "define1": { "0": "zero", "1": "one" }, "define2": { "0": "zero", "1": "one", "2": "two" } }
of course expected 'yaml-cpp' parse same way it's somehow different.
i guess it's this. (almost sure)
{ "define1": { "0": "zero", "1": "one" }, "define2": { "define1": { "0": "zero", "1": "one" }, "2": "two" } }
what hell! have check node type while looping?
is known issue? or 'yaml-cpp' parse way?
this code how did.
// parsed const yaml::node& node = &(docyaml)["define2"]; (yaml::iterator it=node->begin(); it!=node->end(); ++it) { const yaml::node& nodelist = it.second(); std::string str; nodelist[0] >> str; }
yaml-cpp doesn't implement "merge" key yet. if want follow issue until it's implemented, see http://code.google.com/p/yaml-cpp/issues/detail?id=41.
for now, yaml-cpp parsing yaml file as:
{ "define1": { "0": "zero", "1": "one" }, "define2": { "<<": { "0": "zero", "1": "one" }, "2": "two" } }
Comments
Post a Comment