diff -r 1a067a217454 -r a2aa84f310a5 streamlet-examples/xpath.cpp --- a/streamlet-examples/xpath.cpp Wed Jan 29 18:41:42 2020 +0100 +++ b/streamlet-examples/xpath.cpp Wed Jan 29 20:50:12 2020 +0100 @@ -21,6 +21,27 @@ #include #include +/** + * This streamlet provides values from XML files. + * It uses the XPath language to define, what portion of XML should be returned. + * + * With no options it does not provide any attributes. + * + * XPath expressions are passed as 'attribute' options. + * e.g. --option 'attribute' 'name()' will return single attribute with the name of the root node. + * + * Attributes can be renamed using aliases: --option 'attribute' 'name()' --as 'name'. Otherwise the full XPath expression is used as a name. + * Number of aliases should match the number of attributes (otherwise only first attributes are renamed, because aliases are global, not relative to the --option). + * + * Like relpipe-in-xmltable, this streamlet supports several modes: + * - string + * - boolean + * - raw-xml + * - line-number + * - xpath + * + * TODO: more OOP, move to separate repository, proper CMake project, clean-up, stabilize API + */ class XPathStreamlet : public Streamlet { private: xmlpp::Node::PrefixNsMap ns;