simplexml parsing fails if only one item |
[eluser]bobbob[/eluser]
I have an odd problem with a script that has been running for months successfully. The feed format has not been changed. I may not have noticed that with one item the script fails to read the xml. My function has this: Code: <?php Then each item is added to the database. Any idea why with one ARTICLE it fails but with more than one it runs fine? XML: Code: <?xml version="1.0"?> Code: <ARTICLE ID="4546" POSTING_DATE="29-Aug-2009" POSTING_TIME="09:00" ARCHIVE_DATE="19-Aug-2010">
[eluser]bobbob[/eluser]
Nothing?? Very rarely is there only one feed but if someone can see the possible error that would be great
[eluser]pistolPete[/eluser]
[quote author="bobbob" date="1251665858"]... Any idea why with one ARTICLE it fails but with more than one it runs fine? ...[/quote] What does "fail" mean exactly? Do you get an error message? Is the XML valid? http://www.validome.org/xml/
[eluser]bobbob[/eluser]
What happens is nothing gets added to the database. The script does add one line of 0 which is a strtotime of an index that apparently isn't set. It shows that one loop happened. The errors implies that some of the indexes in the xml aren't set but they are there. Anyway this doesn't normally matter as some indexes aren't set and my script doesn't mind. It takes what is there and adds it. For some reason it can't see any of it in this case. Example: Quote:A PHP Error was encounteredAny other ideas?
[eluser]pistolPete[/eluser]
Do you have to use this library? Do you use PHP4 or PHP5? If you have access to PHP5 you could use the SimpleXML class: Code: $this->load->helper('security'); I just tried it with one and several ARTICLE entries and it worked. |
Welcome Guest, Not a member yet? Register Sign In |