toxml
This commit is contained in:
parent
d3b5a014e1
commit
7b66313c01
19
toxml.php
Normal file
19
toxml.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
$yaml = yaml_parse_file($argv[1]);
|
||||
$xml = new SimpleXMLElement("<lanScanConf></lanScanConf>");
|
||||
|
||||
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();
|
||||
?>
|
Reference in New Issue
Block a user