DOMDocument parsing


Posted on 16th Feb 2014 07:03 pm by admin

Hello, I am parsing an xml file from an API which I have converted into a DOMDocument in php. This is mostly fine but one problem I have is when I do this:
Code: [Select]$feeditem->getElementsByTagName('extra');
as part of a forall statment and the element extra doesn't exist in one of the feeditems I am iterating through in the forall condition then I get an error.

I think I need some kind of statment like:

Code: [Select]if ($feeditem->getElementsByTagName('extra') ISN'T NULL)
But don't know how to formulate it. Please help. Thanks.

No comments posted yet

Your Answer:

Login to answer
133 Like 5 Dislike
Previous forums Next forums
Other forums

Transaction variant for VA02 not working
My requirement is to have transaction for user to only add the output and print a sales order.

Embedding flash object in Else statement
This is my first major project in PHP and I'm having some trouble embedding a flash object in an Els

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
what is wrong with this

Code: [Select]<?php
if ($_SERVER['HTTP_REFERER'])
{

Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the

convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javasc

How to create a static html menu from a database
Hi,

I have built a small cms which allows me to create simple html pages and then upload them

How to get all server headers like Live http Headers does
Hey all, like many of you I use the Firefox addon "Live http Headers". I'm trying to write

adding up might be solved tell us cheers.
i think i finally solved this anybody.

last time i was getting the wrong results.

Code

Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash