Soapbox / laravel-formatter

A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class
249 stars 95 forks source link

Error while converting XML #22

Closed sanderkoenders closed 6 years ago

sanderkoenders commented 9 years ago

I got the following error while trying to convert a xml file to json.

error

Any idea what causes this issue?

~ Archcry

Jaspaul commented 9 years ago

Hi @Archcry could you provide a copy of the xml data?

My guess however is that simplexml_load_string doesn't like the xml data that you've provided.

sanderkoenders commented 9 years ago

Yes that's right, I wrote a XML parser myself with some other features I needed for my implementation and found that some parts of the XML file did not get accepted by simplexml_load_string. Luckely I am now working with a xml walker which gives me the xml piece for piece and therefore I added a @ in front of simplexml_load_string so it will silently fail there and continue with the next piece. Not the most elegant solution but it works for us. (the files are all valid xml though, so it seems to be a bug in simplexml_load_string)

Jaspaul commented 9 years ago

If you do manage to find / create something more reliable than simplexml_load_string let me know and I'll see if I can integrate it.

Also if you could provide some xml that causes the issue I could look into possibly adding something a better than @ as a solution?