×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Error trapping of xml in php

Error trapping of xml in php

Error trapping of xml in php

(OP)
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

RE: Error trapping of xml in php

Quote:

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

RE: Error trapping of xml in php

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close