Jump to content

Problem with &


Pkas

Recommended Posts

Hi

 

I've created a XML parser to get some of the elements and inserting in a Mysql DB.

Basically i need to get 4 elements, Title, Date, Body; user, but the XML have much more elements.

 

XML

<taginit>

<...>

<title> blablabla </title>

<...>

<date>2007-10-23T19:25:11.898+00:00</date>

<body>

In here is where i found the problem because after the & apears the rest of the text

</body>

<user>me</user>

 

PHP Parser

 

(...)

function starTag($...)

function endTag($...)

 

function contentTag($parser, $data) {

globals....

 

if($cur_tag == "TITLE") { $titleS = $data; }

if($cur_tag == "DATE") { $dateS = $data; }

if($cur_tag == "USER") { $userS = $data; }

if($cur_tag == "TEXT") { $bodyS .= $data; }  // the element body have many lines with the tag TEXT

 

Now i've just texted the results with a echo.

 

echo("----<br> title: ".$titleS."<br>");

echo("date: ".$dateS."<br>");

echo("body: ".$bodyS."<br>");

echo("user: ".$userS."<br>----");

 

 

This is an example of what i see:

----

title: blablabla

date: 2007-10-23T19:25:11.898+00:00

body: In here is where i found the problem because after the &

user: me

----

 

i've tried the all thing (i think) utf8_decode, htmlentities, htmlspecialchars... even tried to replace at the begining of the parser the & .. nothing.. i've run out of ideias, probably this is the most nobish thing to do.. but someone can help me?

I receive hundreds of XML files by hour and it´s impossible to replace in the XML origin.

The only thing i want is to have the all text available.

 

Tku

Pkas

Link to comment
https://forums.phpfreaks.com/topic/76381-problem-with-amp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.