Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP - SimpleXML parse error
    primarykey
    data
    text
    <p>SEE EDITS AT BOTTOM TO SHOW MORE ACCURATE ERROR OUTPUT</p> <p>I'm parsing somewhat large (~15MB) XML files with PHP for the first time using SimpleXML. The files are flight search results so they have long attributes (links back to Kayak; example:<br> "/book/flightcode=1238917408.NxJI6G.0.F.ORBITZAIR,ORBITZAIR.0.f36f1ea92513977249aa695112410052&amp;<em>sid</em>=26-Vu01v7ilzhSAjPVLZ3Ul"</p> <p>SimpleXML throws this error when parsing:</p> <p>"Entity: line 10: parser error : EntityRef: expecting ';' in" and then; </p> <p>"38917408.NxJI6G.0.F.ORBITZAIR,ORBITZAIR.0.f36f1ea92513977249aa695112410052&amp;<em>sid</em> in" and then;</p> <p>"simplexml_load_string() [function.simplexml-load-string]: ^ in,"</p> <p>and so forth for each line where there are these urls. </p> <p>I found a mention of SimpleXML not liking long attributes on php.net with no solution. I would rather just use and learn SimpleXML for now and work past this error if there is a non-janky, somewhat easy workaround. </p> <p>Does anyone have a solution? Thanks in advance!</p> <p>I tried entering the first 13 lines of the XML but it only outputs the info without the XML so.... I can do that if it will help. I'm not sure if using another parser/extension would reduce the functionality or ease of use but please feel free to suggest another if there's not workaround (DOM or XMLReader is what I'm thinking perhaps).</p> <p>EDITS BELOW TO INCLUDE LESS ADULTERATED ERROR OUTPUT:</p> <p><a href="http://dl.dropbox.com/u/10206237/stack_overflow_xml.xml" rel="noreferrer">http://dl.dropbox.com/u/10206237/stack_overflow_xml.xml</a></p> <p>ERROR 1:</p> <pre><code>simplexml_load_string() [&lt;a href='function.simplexml-load-string'&gt;function.simplexml-load-string&lt;/a&gt;]: Entity: line 10: parser error : EntityRef: expecting ';' in </code></pre> <p>ERROR 2:(The XML I think is fine because it works with a Python script using DOM; I'm translating it to PHP because I don't know Python). I didn't know that the output in the browser would be different. Thanks for being patient.)</p> <pre><code>&lt;a href='function.simplexml-load-string'&gt;function.simplexml-load-string&lt;/a&gt;]: 38917408.Pt8rW8.0.F.ORBITZAIR,ORBITZAIR.0.f36f1ea92513977249aa695112410052&amp;amp;_sid_ in </code></pre> <p>ERROR 3:</p> <pre><code>function.simplexml-load-string&lt;/a&gt;]: ^ in </code></pre> <p>(all of those spaces are in there)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload