# HG changeset patch # User František Kučera # Date 1609372993 -3600 # Node ID 9f95cfd68f25ba1afbe9a6dc895a41f1b69fc200 # Parent 7f2d09c3b1de3e3c42a89c0bad5e93d4f268e197 todo comments diff -r 7f2d09c3b1de -r 9f95cfd68f25 src/XPathHandler.h --- 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 (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)); }