#!/usr/bin/env php convert($xml->asXML()); $converter->validate(json_decode($json)); if ($json_path !== null) { file_put_contents($json_path, $json); } } catch (\Exception $e) { echo "File: $xml_path\n"; echo $e->getMessage(); die(1); }