Re: XML Parser misbehaves with &
| From: | Timo Boettcher | Date: | Tue, 19 Aug 2003 11:24:23 +0000 |
| Subject: | Re: XML Parser misbehaves with & | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160002@lists.php.net to get a copy of this message | ||
Hi Jeff,
Nachricht vom Montag, 18. August 2003, 18:14:37:
> I've come across this frustrating behavior with the XML parser when it
> reads an escaped ampersand (&)
> If the xml being evaluated is: <COLORS>Blue, Green & Red</COLORS>
> it calls the character data handler 3 times:
> the first time the $data is "Blue, Green "
> the second time is "&"
> and the third time is " Red"
> Needless to say this is screwing up my parser, and the stuff I'm
> doing won't make it easy to add this allowance. I'm hoping
> somebody can point out a way to turn off this behavior. If this is
> the proper operation, is it documented anywhere? I've been unable to
> find it.
xml is a www.w3c.org recomendation.
Its documented at http://www.w3.org/TR/REC-xml
http://www.w3.org/TR/REC-xml#syntax states:
"The ampersand character (&) and the left angle bracket (<) may appear
in their literal form only when used as markup delimiters, or within a
comment, a processing instruction, or a CDATA section. If they are
needed elsewhere, they must be escaped using either numeric character
references or the strings "&" and "<" respectively."
HTH
Timo