std::stringstream result_;
std::stringstream current_object_;
std::stack<std::string> nodes_stack_;
+ std::string key_;
public:
bool start_object(std::size_t elements) override
{
+ nodes_stack_.push(key_);
if (!started_) { started_ = true ; return true; } // ignore first start object (which is whole json object {)
indent_ += ANNA_XML_INDENTATION_SPACES;
result_ << std::string(indent_, ' ') << "<" << nodes_stack_.top();
if (close == "") result_ << "</" << nodes_stack_.top() << ">";
result_ << "\n";
current_object_.str("");
+ nodes_stack_.pop();
return true;
}
bool start_array(std::size_t elements) override
{
+ nodes_stack_.push(key_);
result_ << current_object_.str() << ">\n";
current_object_.str("");
return true;
bool key(string_t& val) override
{
if (val[0] != '@') {
- nodes_stack_.push(val);
+ key_ = val;
}
else {
current_object_ << " " << val.substr(1) << "=";