Issues with SimpleXML for development

php.internals

Rowan Lewis

20 years ago
First off, forgive me if I'm using the wrong list. Anyhow, I've been developing a program that uses XML to store cache files, and I've noticed a highly painfully issue with the SimpleXML extension: It converts <textarea></textarea> (and many other like valid XML and HTML elements) to <textarea /> (only valid XML). This, for anyone dealing with XHTML, is a big issue, as it will cause any page to break, one solution would be to use XSL, but the PHP5 extension for that doesn't support XHTML, and causes many more issues. There is a bug about this marked 'bogus', but I'd just like to point out that this bug is not bogus and is a severe hindrance to anyone using SimpleXML. Bug: http://bugs.php.net/bug.php?id=32307
-- ____ Rowan Lewis (AKA. The Wolf)

Bastian Grupe

20 years ago
Hi Rowan, the PHP5 XSL extension *does* support XHTML and HTML. And yes, you should use a more general/help list for that kind of issues. Rowan Lewis wrote:

Christian Stocker

20 years ago
On 27.11.2005 21:50 Uhr, Rowan Lewis wrote:
> First off, forgive me if I'm using the wrong list. > > Anyhow, I've been developing a program that uses XML to store cache > files, and I've noticed a highly painfully issue with the SimpleXML > extension: > > It converts <textarea></textarea> (and many other like valid XML and > HTML elements) to <textarea /> (only valid XML).
What's exactly your problem? *** <?php $xml = simplexml_load_string('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <textarea/> <p/> <br/> </body> </html>'); print ( $xml->body->asXML()); *** $ php5 xhtml.php <body> <textarea></textarea> <p></p> <br /> </body> *** Anyway, not a PHP issue, libxml2 handles all that, so maybe upgrading libxml2 helps... chregu
> > This, for anyone dealing with XHTML, is a big issue, as it will cause > any page to break, one solution would be to use XSL, but the PHP5 > extension for that doesn't support XHTML, and causes many more issues. > > There is a bug about this marked 'bogus', but I'd just like to point > out that this bug is not bogus and is a severe hindrance to anyone > using SimpleXML. > > Bug: http://bugs.php.net/bug.php?id=32307 > > -- > ____ > Rowan Lewis (AKA. The Wolf) >
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | christian.stocker@bitflux.ch | GPG 0x5CE1DECB