# Issues with SimpleXML for development

- Thread: https://externals.io/message/20670
- Original archive: https://news-web.php.net/php.internals/20670
- Started by Rowan Lewis on 2005-11-27T20:50:03+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #20670 — Rowan Lewis — 2005-11-27T20:50:03+00:00

URL: https://externals.io/message/20670#20670

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)

---

## #20672 — Bastian Grupe — 2005-11-27T21:00:49+00:00

URL: https://externals.io/message/20670#20672 · In reply to: #20670

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:
> 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)

---

## #20673 — Christian Stocker — 2005-11-27T21:10:12+00:00

URL: https://externals.io/message/20670#20673 · In reply to: #20670

> 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
