Re: Invalid chars in XML
| From: | Ellis Antaya | Date: | Tue, 21 Sep 2010 00:18:27 +0000 |
| Subject: | Re: Invalid chars in XML | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308228@lists.php.net to get a copy of this message | ||
CDATA tags is what you need
---
Ellis
(Sent from my iPod)
On 2010-09-20, at 16:57, Bastien Koert <phpster@gmail.com> wrote:
> On Mon, Sep 20, 2010 at 4:07 PM, robert mena <robert.mena@gmail.com> wrote:
>> Hi,
>>
>> I am trying to parse a XML file with simplexml_load but it gave me error.
>> While inspecting the contents I found a & inside the value of a tag.
>> <tag>something & something</tag>.
>>
>> After I've removed the & everything went fine. So which chars I should not
>> put in my file? Should I use some conversion function like html_entities?
>>
>> Does the receiver of the XML has to do anything to convert is back?
>>
>
>
> The following should not be used inside XML
>
> & ampersand
> ' single quote
> " double quote
>> greater than
> < less than
>
> you could simply wrap all your data in CDATA tags
> --
>
> Bastien
>
> Cat, the other other white meat
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>