diff --git a/repos/base/include/util/xml_node.h b/repos/base/include/util/xml_node.h index 7dd4eefd0c..171e4d10d7 100644 --- a/repos/base/include/util/xml_node.h +++ b/repos/base/include/util/xml_node.h @@ -990,6 +990,26 @@ class Genode::Xml_node } } + /** + * Execute functor 'fn' for each attribute + */ + template + void for_each_attribute(FN const &fn) const + { + if (!_tags.start.has_attribute()) + return; + + for (Xml_attribute attr = _tags.start.attribute(); ; ) { + fn(attr); + + Token const next = attr._next_token(); + if (!Xml_attribute::_valid(next)) + return; + + attr = Xml_attribute(next); + } + } + /** * Return true if sub node of specified type exists */