--- a/nbproject/configurations.xml Fri Nov 20 11:59:15 2020 +0100
+++ b/nbproject/configurations.xml Wed Nov 25 17:28:17 2020 +0100
@@ -102,8 +102,6 @@
<preBuildFirst>true</preBuildFirst>
</preBuild>
</makefileType>
- <item path="src/XMLNameCodec.h" ex="false" tool="3" flavor2="0">
- </item>
<item path="src/relpipe-in-xmltable.cpp" ex="false" tool="1" flavor2="0">
<ccTool flags="0">
</ccTool>
@@ -145,8 +143,6 @@
</makefileType>
<item path="src/XMLDocumentConstructor.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="src/XMLNameCodec.h" ex="false" tool="3" flavor2="0">
- </item>
<item path="src/relpipe-in-xmltable.cpp" ex="false" tool="1" flavor2="0">
<ccTool flags="0">
</ccTool>
--- a/src/XMLDocumentConstructor.h Fri Nov 20 11:59:15 2020 +0100
+++ b/src/XMLDocumentConstructor.h Wed Nov 25 17:28:17 2020 +0100
@@ -88,48 +88,37 @@
if (!yaml_parser_parse(&yamlParser, &event)) {
// FIXME: throw exception
- std::wcerr << L"YAML error" << std::endl;
return;
}
if (event.type == YAML_STREAM_END_EVENT) {
- std::cerr << "YAML_STREAM_END_EVENT" << std::endl;
yaml_event_delete(&event);
break;
} else if (event.type == YAML_STREAM_START_EVENT) {
- std::cerr << "YAML_STREAM_START_EVENT" << std::endl;
} else if (event.type == YAML_NO_EVENT) {
- std::cerr << "YAML_NO_EVENT" << std::endl;
current->add_child("null"); // TODO: null?
} else if (event.type == YAML_DOCUMENT_START_EVENT) {
- std::cerr << "YAML_DOCUMENT_START_EVENT" << std::endl;
} else if (event.type == YAML_DOCUMENT_END_EVENT) {
- std::cerr << "YAML_DOCUMENT_END_EVENT" << std::endl;
} else if (event.type == YAML_ALIAS_EVENT) {
- std::cerr << "YAML_ALIAS_EVENT" << std::endl;
// TODO: alias?
} else if (event.type == YAML_SCALAR_EVENT) {
if (mode.back() == Mode::SEQUENCE) {
- std::cerr << "YAML_SCALAR_EVENT: Mode::SEQUENCE: " << event.data.scalar.value << std::endl;
current->add_child(itemName)->add_child_text(y2x(event.data.scalar.value));
} else if (mode.back() == Mode::MAPPING) {
- std::cerr << "YAML_SCALAR_EVENT: Mode::MAPPING: " << event.data.scalar.value << std::endl;
current = current->add_child(y2xname(event.data.scalar.value));
mode.push_back(Mode::MAP_KEY);
} else if (mode.back() == Mode::MAP_KEY) {
- std::cerr << "YAML_SCALAR_EVENT: Mode::MAP_KEY: " << event.data.scalar.value << std::endl;
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;
+ // TODO: process YAML_SCALAR_EVENT
}
} else if (event.type == YAML_SEQUENCE_START_EVENT) {
- std::cerr << "YAML_SEQUENCE_START_EVENT" << std::endl;
xmlpp::Element* parent = current->get_parent();
if (parent) {
itemName = current->get_name();
@@ -141,30 +130,24 @@
if (mode.back() == Mode::MAP_KEY) mode.pop_back();
mode.push_back(Mode::SEQUENCE);
} else if (event.type == YAML_SEQUENCE_END_EVENT) {
- std::cerr << "YAML_SEQUENCE_END_EVENT" << std::endl;
mode.pop_back(); // TODO: assert sequence?
} else if (event.type == YAML_MAPPING_START_EVENT) {
if (mode.back() == Mode::ROOT) {
- std::cerr << "YAML_MAPPING_START_EVENT: Mode:ROOT" << std::endl;
} else if (mode.back() == Mode::SEQUENCE) {
- std::cerr << "YAML_MAPPING_START_EVENT: Mode::SEQUENCE" << std::endl;
current = current->add_child(itemName);
} else if (mode.back() == Mode::MAP_KEY) {
- std::cerr << "YAML_MAPPING_START_EVENT: Mode::MAP_KEY" << std::endl;
mode.pop_back();
} else {
- std::cerr << "YAML_MAPPING_START_EVENT: Mode::?" << std::endl;
// TODO: map might be a key of another map → wrap/nest
}
mode.push_back(Mode::MAPPING);
} else if (event.type == YAML_MAPPING_END_EVENT) {
- std::cerr << "YAML_MAPPING_END_EVENT" << std::endl;
current = parentOrSelf(current);
mode.pop_back(); // TODO: assert map?
} else {
- std::cerr << "???" << std::endl;
+ // TODO: unsupported type?
}
yaml_event_delete(&event);