diff --git a/toxml.php b/toxml.php new file mode 100644 index 0000000..235c80c --- /dev/null +++ b/toxml.php @@ -0,0 +1,19 @@ +"); + +foreach ($yaml as $groupName => $hosts) { + $xmlGroup = $xml->addChild("group"); + $xmlGroup->addAttribute("name", $groupName); + if ($hosts) foreach ($hosts as $hostName => $services) { + $xmlHost = $xmlGroup->addChild("host"); + $xmlHost->addAttribute("name", $hostName); + if ($services) foreach ($services as $service) { + $xmlHost->addChild("service"); + $xmlHost->addAttribute("name", $service); + } + } +} + +echo $xml->asXML(); +?>