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 Quote Link to comment Share on other sites More sharing options...
aschk Posted November 7, 2007 Share Posted November 7, 2007 Ok, so what do you want "&" or "&" ? Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment Share on other sites More sharing options...
Pkas Posted November 8, 2007 Author Share Posted November 8, 2007 bump! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.