Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error trapping of xml in php

Status
Not open for further replies.

bradoirs

Technical User
Jul 8, 2009
35
GB
I have recently ventured into the world of xml and am successfully updating data from an xml file but am having difficulty when there is a problem in the xml. I have solved the problem of trying to copy a file that is missing using file_exists but my latest issue doesn't even allow me to reach that point besides which the file referred to does exist so I need to actually trap the error at source - any ideas?

Fatal error: Call to a member function getElementsByTagName() on a non-object in /homepages/36/d88310874/htdocs/mydata/XML/bringData.php5 on line 77

The tag is <image> apparently identical to 400+ other records, the url within the tag is correct and the image exists.

If I remove the offending line from the xml file all the other 25000+ lines read and import perfectly. Baffled does not begin to describe it. Xml is still pretty much a mystery so all help greatly appreciated but keep it simple please
 
Fatal error: Call to a member function getElementsByTagName() on a non-object

Means you haven't created the DOMDocument object you are trying to reference.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
And where are you calling getElementsByTagName()?

The error indicates that you are doing something like [xXXXx].getElementsByTagName(), however, [xXXXx] is not an object and therefore does not have access to that particular method.

Figure out where you are calling getElementsByTagName(), and why the object you are calling it form is not actually an object at that point.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top