new DomElement and Ampersand(&) in string
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

new DomElement and Ampersand(&) in string

From: <petermichaux@yahoo.com>
Date: Sat Jul 16 2005 - 18:39:27 CEST

Hi,

I'm trying the following code (ultimately I want a node with a URI like
index.php?foo=1&bar)

<?php

$foo = new DomElement('foo','foo&bar');

?>

and get the following error message

ERRNO: 2
TEXT: unterminated entity reference bar
LOCATION: /users/peter/store/index.php, line 3, at July 16, 2005, 9:35
am
Showing backtrace:
DOMElement.__construct("foo", "foo&bar") # line 3, file:
/users/peter/store/index.php

I cannot find a way to escape the ampersand so that the DomElement
constructor will take it as a character. I tried &amp; which is no
different, I tried \& which is no different.

Thanks,
Peter
Received on Mon Oct 17 21:08:43 2005