Re: XML char data parsing

From: Date: Fri, 15 Mar 2002 02:39:26 +0000
Subject: Re: XML char data parsing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-88611@lists.php.net to get a copy of this message
On Thu, Mar 14, 2002 at 05:18:03PM -0500, Thalis A. Kalfigopoulos wrote: > If I send just a line of simple text (like "The quick brown fox > drowned") for XML parsing, why doesn't it call the function which I > declare for character data handling? It doesn't even give me an error > :-( Is it wrong to have plain text as input for XML parsing? Why, as a matter of fact, yes! The data going into the parser needs to be valid, well-formed, XML. I assume you didn't get an error message because you didn't ask to see the error message. The most basic thing you can do is (assuming you've already declared your XML Parser functions... $Contents = '<BLAH>The quick brown fox drowned</BLAH>'; if ( xml_parse($Parser, $Contents) ) { echo "Yipee!\n"; } else { echo "Rejected by parser:\n"; echo xml_error_string(xml_get_error_code($Parser)); } Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution 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

« previous php.general (#88611) next »