--- a/src/XMLDocumentConstructor.h Wed Oct 28 16:30:58 2020 +0100
+++ b/src/XMLDocumentConstructor.h Fri Nov 20 00:09:59 2020 +0100
@@ -16,21 +16,24 @@
*/
#pragma once
-namespace relpipe {
-namespace in {
-namespace xmltable {
-
#include <codecvt>
#include <vector>
#include <libxml++-2.6/libxml++/libxml++.h>
#include <yaml.h>
+#include "XMLNameCodec.h"
+
+namespace relpipe {
+namespace in {
+namespace xmltable {
+
class XMLDocumentConstructor {
private:
std::istream* input = nullptr;
xmlpp::DomParser* parser = nullptr;
yaml_parser_t yamlParser;
+ XMLNameCodec nameCodec;
enum class Mode {
ROOT,
@@ -48,7 +51,7 @@
*length = input->gcount();
return (input->good() || input->eof()) ? 1 : 0;
}
-
+
/**
* Both YAML and XML strings are in UTF-8.
*/
@@ -56,10 +59,8 @@
return value ? (const char*) value : "";
}
- const std::string y2xname(yaml_char_t* value) {
- // FIXME: escaping, assure valid XML names
- //return std::string("name_") + y2x(value);
- return y2x(value);
+ const Glib::ustring y2xname(yaml_char_t* value) {
+ return nameCodec.encode(y2x(value));
}
xmlpp::Element* parentOrSelf(xmlpp::Element* current) {