diff --git a/library/Icinga/Data/Tree/NodeRenderer.php b/library/Icinga/Data/Tree/NodeRenderer.php
new file mode 100644
index 000000000..4cebb7e01
--- /dev/null
+++ b/library/Icinga/Data/Tree/NodeRenderer.php
@@ -0,0 +1,58 @@
+content[] = '
';
+ }
+
+ public function endIteration()
+ {
+ $this->content[] = '
';
+ }
+
+ public function beginChildren()
+ {
+ $this->content[] = '';
+ }
+
+ public function endChildren()
+ {
+ $this->content[] = '
';
+ }
+
+ public function render($callback)
+ {
+ if (! is_callable($callback)) {
+ throw new RuntimeException('Callable expected');
+ }
+ foreach ($this as $node) {
+ try {
+ $content = call_user_func($callback, $node);
+ } catch (Exception $e) {
+ throw new RuntimeException($e);
+ }
+ $this->content[] = $content;
+ }
+ return implode("\n", $this->content);
+ }
+}