Re: [PHP] XML Parser misbehaves with amp;
Hello, It's not misbehaving and it's not illegal xml. It's a well documented fact that the character data function may be called more than once. The normal programming practice is to put the strings that are given to you at each call into a buffer. Then you write code in the end handler to process it, and to reset the buffer after processing. Justin Farnsworth wrote: This is normal. You have illegal XML there, as it should be in ![CDATA[ value ]]. I have run across this, and have to clean it up with an awk script. Ampersand is a no-no. Just running xmllint on the file will tell you about the problem(s). _justin Jeff Bearer wrote: I've come across this frustrating behavior with the XML parser when it reads an escaped ampersand (amp;) If the xml being evaluated is: COLORSBlue, Green amp; 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. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Raditha Dissanayake - http://www.radinks.com/sftp/ Lean and mean Secure FTP applet with Graphical User Inteface. just 150 Kilo Bytes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Parser misbehaves with amp;
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 (amp;) If the xml being evaluated is: COLORSBlue, Green amp; 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 amp; and lt; respectively. HTH Timo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Parser misbehaves with amp;
Timo Boettcher wrote: 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 (amp;) If the xml being evaluated is: COLORSBlue, Green amp; Red/COLORS 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 amp; and lt; respectively. HTH Timo Which seems to have been done by Nachricht. As mentioned before it's perfectly normal for sax parsers to fire too events for the same text block. The expat parser is well known for this behaviour. -- Raditha Dissanayake - http://www.radinks.com/sftp/ Lean and mean Secure FTP applet with Graphical User Inteface. just 150 Kilo Bytes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Parser misbehaves with amp;
I've come across this frustrating behavior with the XML parser when it reads an escaped ampersand (amp;) If the xml being evaluated is: COLORSBlue, Green amp; 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. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Parser misbehaves with amp;
This is normal. You have illegal XML there, as it should be in ![CDATA[ value ]]. I have run across this, and have to clean it up with an awk script. Ampersand is a no-no. Just running xmllint on the file will tell you about the problem(s). _justin Jeff Bearer wrote: I've come across this frustrating behavior with the XML parser when it reads an escaped ampersand (amp;) If the xml being evaluated is: COLORSBlue, Green amp; 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. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Parser misbehaves with amp;
The data contains escaped ampersands - amp; Which is as far as I know the way one represents ampersands in their data. In my post below, the value of $data the second time is because it has been evaluated by the xml parser. And btw xmllint has no problems with amp; On Mon, 2003-08-18 at 12:41, Justin Farnsworth wrote: This is normal. You have illegal XML there, as it should be in ![CDATA[ value ]]. I have run across this, and have to clean it up with an awk script. Ampersand is a no-no. Just running xmllint on the file will tell you about the problem(s). _justin Jeff Bearer wrote: I've come across this frustrating behavior with the XML parser when it reads an escaped ampersand (amp;) If the xml being evaluated is: COLORSBlue, Green amp; 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. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php