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
Share on other sites

only the text!

 

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

 

I do not understand what the & or &amp, is doing in the middle of the text.. but truncates the text at that point.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.