W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2006


From: Rasmus Lerdorf <rasmus@lerdorf.com>
Date: Fri, 10 Feb 2006 10:20:21 -0800
Message-ID: <43ECD965.5090704@lerdorf.com>
To: html-tidy@w3.org

I am probably missing something, but it seems that if input-xml is set, 
indent and many other options don't work.


$dom = new DOMDocument('1.0', 'UTF-8');
$el1 = $dom->createElement('top', 'Test 1');
$el2 = $dom->createElement('level2', 'Test 2');
$el3 = $dom->createElement('level3', 'Test 3');

$config = array('input-xml' => true,
                 'indent' => true,
                 'indent-spaces' => 4,
                 'wrap' => 4096,
$tidy = tidy_parse_string($dom->saveXML(), $config, 'UTF8');
echo $tidy;


<?xml version="1.0" encoding="utf-8"?>
<top>Test 1
<level2>Test 2
<level3>Test 3</level3></level2></top>

I was hoping for something a bit prettier.  If I run it through the HTML 
parser instead by not setting input-xml but otherwise use the same 
options, I get:

<?xml version="1.0" encoding="utf-8"?>
         Test 1Test 2Test 3

Which is pretty, but not really what I was after.  ;)

(example code is PHP, but it shouldn't really matter)

Received on Friday, 10 February 2006 19:56:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:56 UTC