DOM saveHTML() not outputting XHTML Strict

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a class which will build, and output, an HTML table. To create the internal elements more simply I'm using a DOMDocument, with a root element of 'table' then outputting with the ->saveHTML() method.

This has worked fine during development, but I've run into a problem. In this table I have a drop-down list (<select> with <options>). If I want to set an option to selected I do this:

$oOption->setAttribute('selected','selected');

Which, unfortunately, outputs as `<option selected>` instead of `<option selected="selected">`

I need my output HTML to conform to XHTML strict.

Is there any way I can force it to output XHTML Strict compliant tags? I guess the theoretically ideal solution would be to have a complete XHTML Strict DOMDocument, with my table in the body, then just outputting the table portion. I haven't found a way to do that without some nasty substr()'s and whatnot.

Is there anyway to specify that a DOMDocument is really a portion of an XHTML Strict page, and output that accordingly?

Just for clarity's sake, outputting ->saveXML() isn't a real attrictive solution because it *always* puts the <?xml ?> tag at the front, which I definitely do not want.

Thanks,
Chris

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux