From cdd65d4c7fe2ecfdf230c3c79b73af68ade68ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Tue, 20 Sep 2022 13:21:29 +0200 Subject: [PATCH] pretty xml --- app/public/index.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/public/index.php b/app/public/index.php index 094d021..23a1f0f 100644 --- a/app/public/index.php +++ b/app/public/index.php @@ -21,6 +21,7 @@ $buttons = [ 'hash' => 'Hash', 'hex' => 'Hex', 'prettyjson' => 'Pretty JSON', + 'prettyxml' => 'Pretty XML', 'serializedtojson' => 'PHP Serialized to JSON', ]; @@ -109,6 +110,15 @@ if ($action == 'reset') { } $help = 'https://www.php.net/json'; +} elseif ($action == 'prettyxml') { + $dom = new DOMDocument('1.0'); + $dom->preserveWhiteSpace = false; + $dom->formatOutput = true; + @$dom->loadXML($str); + + $result = @$dom->saveXML(); + $help = 'https://www.php.net/DOMDocument'; + } elseif ($action == 'serializedtojson') { $stdClass = preg_replace('~O:[0-9]+:"[^"]+"~', 'O:8:"stdClass"', $str); $unserialized = @unserialize($stdClass);