Hi all -

I'm experimenting with PHP's XML parser for an application that maps XML 
tags to MySQL database fields.

As a test for my parsing program, I've been grabbing XML from the 
Slashdot news feed (http://www.slashdot.org/slashdot.xml) and inserting 
it into a database. This is very simple data - <title>blah</title> gets 
inserted into the 'title' field, etc. However, when there are some 
strange characters in the title field, the XML parser seems to choke.

Here is an example. The title of a recent article from Slashdot looks 
like this in the XML file:

<title>Follow-up To Critique of BeOS &amp;amp; Mac OS X</title>

Don't ask my why they have a double ampersand in there... Anyway, the 
XML parser returns this as three sets of data, instead of one. The array 
that I get looks like this:

$myArray[0] = "Follow-up To Critique of BeOS "
$myArray[1] = "&"
$myArray[2] = "amp; Mac OS X"

This is the data I get back from the parser, BEFORE putting it into the 
database. I'm echoing each array field to the screen, just to make sure. 
So I know it has nothing to do with MySQL. The double ampersand 
shouldn't make a difference - the XML parser should not be interpreting 
HTML...right? Also, I don't get an error code or error string from 

Anyone have any ideas? This is a subtle bug - in fact I had been 
satisfied with my XML parsing code, and was well into the rest of my 
application when I happened to notice this.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to