- From: Rasmus Lerdorf <rasmus@lerdorf.com>
- Date: Fri, 10 Feb 2006 10:20:21 -0800
- 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.
eg.
$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');
$el2->appendChild($el3);
$el1->appendChild($el2);
$dom->appendChild($el1);
$config = array('input-xml' => true,
'indent' => true,
'indent-spaces' => 4,
'markup'=>true,
'wrap' => 4096,
);
$tidy = tidy_parse_string($dom->saveXML(), $config, 'UTF8');
echo $tidy;
produces:
<?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"?>
<html>
<head>
<title></title>
</head>
<body>
Test 1Test 2Test 3
</body>
</html>
Which is pretty, but not really what I was after. ;)
(example code is PHP, but it shouldn't really matter)
-Rasmus
Received on Friday, 10 February 2006 19:56:47 UTC