PHP xml parser is cutting urls inside node -
Why the parser is cutting the URL on it:
Inside the node:
< Pre> http://img844.imageshack.us/content.php?page=done&l=img844/4783/php4dd.jpg
After parsing: < / P>
[done_page] => l = img844 / 8828 / php4e8.jpg
private function _perre ($ result) {$ XMLparser = xml_parser_create ('UTF-8'); Xml_set_element_handler ($ XMLparser, array ($ this, 'startElement'), array ($ this, 'endElement')); Xml_set_character_data_handler ($ XMLparser, array ($ this, 'stringElement')); If (! Xml_parse ($ XMLparser, $ result)) {echo '& lt; Br> XML error: '.xml_error_string (xml_get_error_code ($ XMLparser)); 'Line resonance' .xml_get_current_line_number ($ XMLparser); Go out(); } Print_r ($ this-> parsed_results); Xml_parser_free ($ XMLparser); } Public Function String Element ($ parser, $ str) {if (strollen ($ str) gt; {$ this- & gt; precise_rates [$ this-> current_name] = $ str;}} Public Function Started Element ($ parser, $ name, $ attributes) {$ this-> current_name = $ name;} public event endElement ($ parser, $ name) {} & lt; ad_link & gt; http: //img844.imageshack.us/my.php Image = php4e8.jpg & Lt; / ad_link & gt; & lt; thumb_exists & gt; Yes & lt; / thumb_exists & gt; & lt; total_raters & gt; 0 & lt; / total_raters & gt; & lt; ave_rating & gt; 0.0 & lt; / Ave_rating & gt; & nbsp; image_location & gt; img844 / 8828 / php4e8.jpg & lt; / image_location & gt; & lt; thumb_location & gt; img844 / 8828 / php4e8.th.jpg & lt; / thumb_location & gt; ; & Lt; Server & gt; Img844 & lt; / Server & gt; & Lt; Image_name & gt; Php4e8.jpg & lt; / Image_name & gt; & Lt; Done_page & gt; Http: //img844.imageshack.us/content.php Page = K & amp; Amp; L = img844 / 8828 / php4e8.jpg & lt; / Done_page> & Lt; Resolution & gt; 468x458 & lt; / Resolution & gt; & Lt; File size & gt; 118,347 & lt; / File size & gt; & Lt; Image_class & gt; R & lt; / Image_class & gt; & Lt; / Link & gt;
As a result, string element
being said twice, the second call will overwrite the text from the first text node. Try changing the stringElement
so that it can insert the input to any existing text and see if it returns the full string.
In the second exam, I'm pretty sure that parser & amp; Amp; Amp; Amp;
refers to the unit as a separate node, so you may have to re-add all the text yourself, depending on the parser implementation, unit reference can be a different type of node, so you have to research that What does your typical parser unit do with references?
Comments
Post a Comment