Re: simplexml choking on apparently valid XML
| From: | Nathan Nobbe | Date: | Fri, 07 May 2010 22:39:39 +0000 |
| Subject: | Re: simplexml choking on apparently valid XML | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304994@lists.php.net to get a copy of this message | ||
On Fri, May 7, 2010 at 4:32 PM, Brian Dunning <brian@briandunning.com>wrote:
> This time simplexml-load-string also gave me the same error on the
> following line:
>
> <first_name>Charlie & Brady</first_name>
>
> Can anyone confirm whether simplexml-load-string will or will not accept or
> allow XML-encoded characters? It seems that it should and would be pretty
> surprising if it wouldn't.
hmm, both the strings seem to work fine on my laptop:
php > var_dump(simplexml_load_string('<first_name>Charlie &
Brady</first_name>'));
object(SimpleXMLElement)#1 (1) {
[0]=>
string(15) "Charlie & Brady"
}
php > var_dump(simplexml_load_string('<client_orderitem_number>Basketball
Personalized Notebook - Jeff's</client_orderitem_number>'));
object(SimpleXMLElement)#1 (1) {
[0]=>
string(41) "Basketball Personalized Notebook - Jeff's"
}
-nathan