Hi,
I'm trying to read the results of a database query into an XML document but it's only read so far and stopping. The XML document is as follows:
[CODE=xml]
<?xml version="1.0" encoding="utf-8"?>
<night>
<name>Poontan g</name>
<homePageSummar y>Launches 26th November</homePageSummary >
<whatsOnPageSum mary>Every Monday from 26th Nov Door price: £5/£4 Guestlist (07809867930)</whatsOnPageSumm ary
>
<description>Po ontang is of course, a punch made from the fermented juice from the rare poonberry bush
. It became hugely popular during colonial times, it was a favourite of the Founding Fathers, drank constantly
by George Washington, as evedenced by his farewell address, 'I only took the job for the poontang'.
<br />
<br />
The first recorded recipe was printed in Ye Boston Globe. Unfortunately, poontang's immense popularity
was later learned to be the result of addictive qualities. <br />
<br />
The hunger for good quality poontang is said to have made a Bishop kick a hole in a stained glass window
. Withdrawl will occur, leading to unappealing physical &amp; mental consequences, including blue
balls, hairy palms &amp; lack of mental clarity. <br />
<br />
COME SEE THE POONTANG PANDA.... <br />
Performing its erotic pole dance routine <br />
Pouring free poontang punch from the stage <br />
Giveaway baby poontang panda cuddly toys <br />
and if your lucky he might just hump your leg! <br />
<br />
DRINKS <br />
Baby Champers 70p! <br />
Bottles of Sol &amp; Sambucca Shots &pound;1 <br />
Double Spirit &amp; Mixer inc Red Bull &pound;2 .40 <br />
Poontang Pitchers &amp; Red Pig Pithcers &pound;5 <br />
Bottles of House Wine &pound;7 <br />
<br />
MUSIC <br />
Big Panda Party Tunes -&gt; Dance, R'n'B and Indie <br />
<br /></description>
<thumbnail>thum b447.jpg</thumbnail>
<flyer>poon_fly er451.jpg</flyer>
</night>
[/CODE]
I'm using the following the try and sort out the entities.
[CODE=php]
function html_numeric_en tities($str)
{
return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0") .chr(59)', $str);
};
$description = html_numeric_en tities(html_ent ity_decode($row['description']));
$description = $night->appendChild($d om->createElement( 'description', $description));
[/CODE]
But it's only getting so far. I've tried it with just html_entity_dec ode but it gets struck with ampersands and £ signs. So I be using htmlentities when writing to the database, along with addslashes and then html_entity_dec ode when reading from the database. I've also had problems with hyphens. The PHP code can create the database but the Javascript code that reads the XML document when I'm creating an Ajax.Request cannot.
Hopefully some kind soul can guide on what I'm doing wrong.
Thanks,
Sean
I'm trying to read the results of a database query into an XML document but it's only read so far and stopping. The XML document is as follows:
[CODE=xml]
<?xml version="1.0" encoding="utf-8"?>
<night>
<name>Poontan g</name>
<homePageSummar y>Launches 26th November</homePageSummary >
<whatsOnPageSum mary>Every Monday from 26th Nov Door price: £5/£4 Guestlist (07809867930)</whatsOnPageSumm ary
>
<description>Po ontang is of course, a punch made from the fermented juice from the rare poonberry bush
. It became hugely popular during colonial times, it was a favourite of the Founding Fathers, drank constantly
by George Washington, as evedenced by his farewell address, 'I only took the job for the poontang'.
<br />
<br />
The first recorded recipe was printed in Ye Boston Globe. Unfortunately, poontang's immense popularity
was later learned to be the result of addictive qualities. <br />
<br />
The hunger for good quality poontang is said to have made a Bishop kick a hole in a stained glass window
. Withdrawl will occur, leading to unappealing physical &amp; mental consequences, including blue
balls, hairy palms &amp; lack of mental clarity. <br />
<br />
COME SEE THE POONTANG PANDA.... <br />
Performing its erotic pole dance routine <br />
Pouring free poontang punch from the stage <br />
Giveaway baby poontang panda cuddly toys <br />
and if your lucky he might just hump your leg! <br />
<br />
DRINKS <br />
Baby Champers 70p! <br />
Bottles of Sol &amp; Sambucca Shots &pound;1 <br />
Double Spirit &amp; Mixer inc Red Bull &pound;2 .40 <br />
Poontang Pitchers &amp; Red Pig Pithcers &pound;5 <br />
Bottles of House Wine &pound;7 <br />
<br />
MUSIC <br />
Big Panda Party Tunes -&gt; Dance, R'n'B and Indie <br />
<br /></description>
<thumbnail>thum b447.jpg</thumbnail>
<flyer>poon_fly er451.jpg</flyer>
</night>
[/CODE]
I'm using the following the try and sort out the entities.
[CODE=php]
function html_numeric_en tities($str)
{
return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0") .chr(59)', $str);
};
$description = html_numeric_en tities(html_ent ity_decode($row['description']));
$description = $night->appendChild($d om->createElement( 'description', $description));
[/CODE]
But it's only getting so far. I've tried it with just html_entity_dec ode but it gets struck with ampersands and £ signs. So I be using htmlentities when writing to the database, along with addslashes and then html_entity_dec ode when reading from the database. I've also had problems with hyphens. The PHP code can create the database but the Javascript code that reads the XML document when I'm creating an Ajax.Request cannot.
Hopefully some kind soul can guide on what I'm doing wrong.
Thanks,
Sean
Comment