[PHP] Problem of characters with xml_parse

2002-07-30 Thread Sebastien Mole

Hello,

I have a question concerning characters : I use the function xml_parse on a standalone 
XML file with the encoding ISO-8859-1 
and I want to parse it. It contains all types of characters (including control 
characters, so ASCII characters from x to x00FF) so as to send and receive images, 
is it possible?
I noticed that special characters such as ' have to be replaced in 
regard of the W3C definition of XML, and that character such as chr(9) tabulation, 
chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse 
(replaced repectively by #9; #10; #13; but when I try to parse characters such as 
chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I 
replace them by #x (x is the decimal ASCII code of the character). Have you got an 
idea about it?
I tried to find out an answer in the expat scripts used by the function, without any 
results.

Thank you for your answering.



Best regards.

Sébastien Molé.
reply to: [EMAIL PROTECTED]




[PHP] Problem of characters with xml_parse

2002-07-30 Thread Sebastien Mole

Hello,

I have a question concerning characters : I use the function xml_parse on a standalone 
XML file with the encoding ISO-8859-1 
and I want to parse it. It contains all types of characters (including control 
characters, so ASCII characters from x to x00FF) so as to send and receive images, 
is it possible?
I noticed that special characters such as ' have to be replaced in 
regard of the W3C definition of XML, and that character such as chr(9) tabulation, 
chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse 
(replaced repectively by #9; #10; #13; but when I try to parse characters such as 
chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I 
replace them by #x (x is the decimal ASCII code of the character). Have you got an 
idea about it?
I tried to find out an answer in the expat scripts used by the function, without any 
results.

Thank you for your answering.



Best regards.

Sébastien Molé.
reply to: [EMAIL PROTECTED]




Re: [PHP] Problem of characters with xml_parse

2002-07-30 Thread Analysis Solutions

On Tue, Jul 30, 2002 at 05:12:25PM +0200, Sebastien Mole wrote:

 but when I try to parse characters such as chr(#x0001) or
chr(#x001F) (or others) the parser returns me an error


Line wrapping...  What a concept.

In my PHP XML parsing 
tutorial, http://www.analysisandsolutions.com/code/phpxml.htm,
I use the following preg to clean out those nasty characters:

#  Remove all non-visible characters except SP, TAB, LF and CR.
$Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', \n, $Contents);

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Problem of characters with xml_parse

2002-07-30 Thread Rasmus Lerdorf

Can't you just use CDATA blocks?

Personally I'd either use an entity reference or base64 the stuff.

-Rasmus

On Tue, 30 Jul 2002, Sebastien Mole wrote:

 Hello,

 I have a question concerning characters : I use the function xml_parse on a 
standalone XML file with the encoding ISO-8859-1
 and I want to parse it. It contains all types of characters (including control 
characters, so ASCII characters from x to x00FF) so as to send and receive 
images, is it possible?
 I noticed that special characters such as ' have to be replaced in 
regard of the W3C definition of XML, and that character such as chr(9) tabulation, 
chr(10) line feed, and chr(13) carriage return are supported by the function 
xml_parse (replaced repectively by #9; #10; #13; but when I try to parse 
characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an 
error even if I replace them by #x (x is the decimal ASCII code of the character). 
Have you got an idea about it?
 I tried to find out an answer in the expat scripts used by the function, without any 
results.

 Thank you for your answering.



 Best regards.

 Sébastien Molé.
 reply to: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php