PHP XML ident formatter

<?php $dom = new DOMDocument(); $dom->preserveWhiteSpace = false; if ($dom->loadXML($rawXmlData) === true) { $dom->formatOutput = true; echo $dom->saveXML(); } else { echo $rawXmlData; }
Generates human-friendly XML view from raw XML data without idents and line breaks.

1 Response

I can't paste spaces in my description :( It must be:

<?xml version="1.0" encoding="UTF-8"?>
<testData>
__<item>1</item>
__<item>2</item>
</testData>

Where __ - is spaces.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.