From:             dhopkins at mutinydesign dot co dot uk
Operating system: Ubuntu Server
PHP version:      5.2CVS-2007-11-12 (snap)
PHP Bug Type:     Feature/Change Request
Bug description:  DOM doesn't produce valid XHTML.

Description:
------------
This issue is similar to a similar one posted earlier (
http://bugs.php.net/bug.php?id=31130 ).

Basically, I want to use the DOM functions to return valid XHTML - with
trailing slashes - but the saveHTML method returns HTML 4.0 loose. As was
pointed out in the above post, you can just use the saveXML method to
return valid XHTML. However, there is a big problem with this.

If you have a XHTML document that starts with the xml decleration <?xml?>,
Internet Explorer 6 doesn't read the HTML DTD. The result of which is a
skewed document, various CSS attributes are not supported etc. You are
basically trying to display a HTML document with an XML doctype.

Currently, I am just trimming the xml decleration off the document, which
I am sure you can appreciate is not a very good solution, but its the only
option.

Is it possible to add a feature that will return XML without the XML
decleration? Or is this really something I need to take up with LibXML?
There are quite a few people moaning about this issue, but so far no
solutions has been provided.

Reproduce code:
---------------
$doc = new DomDocument();
$input = $doc->createElement('input');
$input->setAttribute('type', 'checkbox');
$input->setAttribute('checked', 'checked');
$doc->appendChild($input);
echo $doc->saveXML();

Expected result:
----------------
<input type="checkbox" checked="checked" />

Actual result:
--------------
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<input type="checkbox" checked />

-- 
Edit bug report at http://bugs.php.net/?id=43260&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43260&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43260&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43260&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43260&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43260&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43260&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43260&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43260&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43260&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43260&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43260&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43260&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43260&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43260&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43260&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43260&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43260&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43260&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43260&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43260&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43260&r=mysqlcfg

Reply via email to