Without any more information, it can be hard to pinpoint where it's coming from.
Odds are it's coming from this line:
$name = $gxpath->query('b')->item(0)->nodeValue;
It could be that the query, item, or nodeValue doesn't exist. Try printing out the contents of $gxpath, then $gxpath->query('b'), etc, so you can figure out what's going on.
As a sidenote, you're printing $glist without actually doing anything with it, other than creating an array.