From: Andreas Neiser Date: Mon, 14 Jul 2014 10:09:52 +0000 (+0200) Subject: xml-db: Adding §HeadNode as special entry containing all top-level items as children X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=30ec6e497c989be984d37495cfb6705c056169ce;p=daqtools.git xml-db: Adding §HeadNode as special entry containing all top-level items as children --- diff --git a/xml-db/xml-db.pl b/xml-db/xml-db.pl index c64c9f5..2e04ee4 100755 --- a/xml-db/xml-db.pl +++ b/xml-db/xml-db.pl @@ -159,6 +159,21 @@ sub WorkOnDoc { push(@{$dbitem->{'children'}}, $childname); } } + + + # add a HeadNode with its top-level children + my $headnode = {}; + my $hn_children = $doc->getDocumentElement->findnodes('group | register | memory | fifo'); + foreach my $childnode (@$hn_children) { + my $childname = $childnode->getAttribute('name'); + + if (not defined $db->{$childname}) { + PrintMessage($childnode, "Fatal Error: Child $childname of §HeadNode not found in database", 1) + } + push(@{$headnode->{'children'}}, $childname); + } + $db->{'§HeadNode'} = $headnode; + return $db; }