allow parsing a single scalar value (plain text) v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Wed, 28 Oct 2020 16:30:01 +0100
branchv_0
changeset 19 aabdab3e05a0
parent 18 737c507a3e32
child 20 e67584a06be6
allow parsing a single scalar value (plain text) directly at the root, without any sequences or maps
src/XMLDocumentConstructor.h
--- a/src/XMLDocumentConstructor.h	Wed Oct 28 00:05:29 2020 +0100
+++ b/src/XMLDocumentConstructor.h	Wed Oct 28 16:30:01 2020 +0100
@@ -121,6 +121,8 @@
 					current->add_child_text(y2x(event.data.scalar.value));
 					current = parentOrSelf(current);
 					mode.pop_back();
+				} else if (mode.back() == Mode::ROOT) {
+					current->add_child_text(y2x(event.data.scalar.value));
 				} else {
 					std::cerr << "YAML_SCALAR_EVENT: ???" << std::endl;
 				}