470,849 Members | 1,109 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

preserving white space with DOMDocument / loadHTML

First, here's my code:

<?php
$xml = new DOMDocument();
$xml->preserveWhiteSpace = true;

$xml->loadXML('
<html>
<head/>
<body/>
</html>
');

$node = $xml->documentElement->getElementsByTagName('body')->item(0);
$node->parentNode->removeChild($node);

echo $xml->saveHTML();
?>

Any ideas as to why that doesn't preserve the whitespace? When I
change saveHTML to saveXML, it works just fine...
Jun 2 '08 #1
0 1174

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Malcolm Dew-Jones | last post: by
reply views Thread by Mark Moore | last post: by
38 posts views Thread by Xah Lee | last post: by
6 posts views Thread by Ot | last post: by
reply views Thread by Mike | last post: by
8 posts views Thread by TheDude5B | last post: by
2 posts views Thread by shagy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.