Re: [PHP-XML-DEV] Re: [PHP] PHP5, XPath and count()
[email protected] (Christian Stocker) Sun, 25 Jul 2004 00:05:41 +0200
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
On 24.7.2004 21:26 Uhr, Victor Boivie wrote:
> I posted this in php.general, but then I found this newsgroup. Maybe
> it's more suitable here (?)
No, it isn't, this is for developing the xml support in php, not
answering questions about xml in php. Bugreports should go to
bugs.php.net, and I answered to your problem (and the solution to it)
already on php-general at Sat, 24 Jul 2004 18:22:47 +0200 ;). But it
obviously didn't get through, so here's it again...
***
Yep, that looks like a bug... Can you please file a bug at bugs.php.net?
The workaround is to write the following:
$node = $dom->createElement("foo");
$text = $dom->createTextNode( "which entities <i>does</i> it
escape & which doesn't it?");
$node->appendChild($text);
$root->appendChild($node);
***
So, please just open a bugreport and someone will take care of it some
day.. And as there's a perfect valid "workaround", it's not thaaaat big
of a deal
chregu
>
> $dom = new DOMDocument();
>
> $root = $dom->createElement("test");
> $dom->appendChild($root);
>
> $node = $dom->createElement("foo", "which entities <i>does</i> it
> escape & which doesn't it?");
> $root->appendChild($node);
>
> echo $dom->saveXML();
>
> The result will be:
>
> <?xml version="1.0"?>
> <test><foo>which entities <i>does</i> it escape </foo></test>
>
> It stops at the &, which I think is strange. It escapes the < to <
> and > to >, but not & to &. It would be better if it escaped none
> or all entites that "can do harm".
>
> Or what do you think?
> regards,
> Victor
>
--
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [email protected] | gnupg-keyid 0x5CE1DECB