- 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 (key_ == "") return true; // global object condition (first start object)
+ nodes_stack_.push(key_); // push on starts
+ indent_ += ANNA_XML_INDENTATION_SPACES; // increase indentation on object start
+
+ if (indent_ != 0) {
+ // New object when previous hadn't attributes:
+ if (current_object_.str().empty() && !has_attributes_) result_ <<">";
+ result_ << "\n";
+ }
+ result_ << std::string(indent_, ' ') << "<" << get_top();
+
+ has_attributes_ = false;