This error is driving me insane, and I know why it's doing it but all attempts to stop it have been unsuccessful.

I wrote a bit of code that pulls a specific value from an XML that I get from another websites API. However, when that section is empty I get this error:

Warning: eveHeaders::hasCorpRoleAPI() [eveheaders.hascorproleapi]: Node no longer exists in /homepages/4/d312038315/htdocs/leaf/eveHeaders.php on line 208

the stuff it's referring to is this: ($roleID in the if statement is line 208)

function hasCorpRoleAPI($characterSheet_xml) {
		// construct the API URL
		$charID = $_SERVER['HTTP_EVE_CHARID'];
		if($charID) {
			$corpID[] = $characterSheet_xml->result->corporationID[0];
			$roleID[] = @$characterSheet_xml->result->rowset[2]->row->attributes(roleID);
			if($corpID[0]==190238797 && roleID[0] == 1) { 
				//Corporation ID matches Leaf Director
					return 1;
			} else {
				//not Leaf director
					return null;
			}
			return null;

	} else {
	//$charID is blank
	}
}

I supressed the error on the initial pull from the XML (line 207), however, the $roleID in the condition below also returns the error which doesn't make any sense to me...

So what I need to know is if there is an easy way to check for blank nodes using SimpleXML (don't really want to switch to DOM even though there is a is_blank_node function already in it) or a way of supressing the error within the if statement (tried the @ symbol...)

Any help, as always, would be greatly appreciated 🙂

    Write a Reply...