--- a/src/XPathHandler.h Wed Dec 30 17:09:15 2020 +0100
+++ b/src/XPathHandler.h Thu Dec 31 01:03:13 2020 +0100
@@ -110,6 +110,7 @@
}
xmlpp::Element* findSingleElement(const xmlpp::NodeSet& nodeset) {
+ // TODO: Allow multiple elements and attributes and wrap them? Like in relpipe-in-xmltable --raw-xml-attribute-wrapper --raw-xml-nodelist-wrapper
if (nodeset.empty()) return nullptr;
else if (nodeset.size() > 1) throw std::invalid_argument("XPath should find one or zero elements.");
else if (xmlpp::Element * element = dynamic_cast<xmlpp::Element*> (nodeset[0])) return element;
@@ -170,6 +171,8 @@
for (auto oa : currentRelationConfiguration->outputAttributes) currentWriterMetadata.push_back({oa.name, oa.type});
if (isAppendingInputAttributes()) copyInputAttributesToOutput();
+ // TODO: better metadata structure
+ // TODO: optional namespaces
dom.create_root_node("relpipe-tr-xpath");
dom.get_root_node()->add_child("relation-name")->add_child_text(s2x(name));
resetRecordElement();
@@ -194,6 +197,7 @@
attributeElement->import_node(attributeParser.get_document()->get_root_node(), true);
}
} else {
+ // TODO: better boolean mapping? Missing text node will be evaluated as false(), however the expression still had to be "someAttribute/text()" because "someAttribute" will be evaluated as true() because the "someAttribute" element is present.
attributeElement->add_child_text(s2x(value));
}