Re: outputting xml with DOM and ampersands

From: Date: Thu, 13 Oct 2005 02:16:43 +0000
Subject: Re: outputting xml with DOM and ampersands
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-224005@lists.php.net to get a copy of this message
On Wednesday 12 October 2005 12:40 pm, jonathan wrote: > I am trying to output a file using DOM with php5. > > It gives me an error with something like the following: > <item_name>farm lettuces with reed avocado, cr&egrave;me > fra&icirc;che, radish and cilantro</item_name> Are you doing a: DOMDocument::loadXML('<item_name>farm lettuces with reed avocado, cr&egrave;me fra&icirc;che, radish and cilantro</item_name>'); You may have to manually convert the & to &amp; tho I thought it did an automatic convertion. > > It does have the encoding set to utf-8. When I switch it to utf-16, > it gives me an error on the $dom->saveXML(); > > Any ideas about how to fix this? > > -jonathan

« previous php.general (#224005) next »