Pkas Posted November 7, 2007 Share Posted November 7, 2007 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 More sharing options...
aschk Posted November 7, 2007 Share Posted November 7, 2007 Ok, so what do you want "&" or "&" ? Link to comment https://forums.phpfreaks.com/topic/76381-problem-with-amp/#findComment-386718 Share on other sites More sharing options...
Pkas Posted November 7, 2007 Author Share Posted November 7, 2007 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 &, is doing in the middle of the text.. but truncates the text at that point. Link to comment https://forums.phpfreaks.com/topic/76381-problem-with-amp/#findComment-386721 Share on other sites More sharing options...
aschk Posted November 7, 2007 Share Posted November 7, 2007 Ah yes, i didn't see that before... Link to comment https://forums.phpfreaks.com/topic/76381-problem-with-amp/#findComment-386723 Share on other sites More sharing options...
Pkas Posted November 8, 2007 Author Share Posted November 8, 2007 bump! Link to comment https://forums.phpfreaks.com/topic/76381-problem-with-amp/#findComment-387398 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.