Assuming <name>s aren't nested, and assuming you don't want to use PHP's XML functions.
preg_match('|<name>(.*?)</name>|si', $xml, $match);
will give the contents of the first available <name> tag (including whitespace) in $match[1].
Change preg_match to preg_match_all, and $match[1] will be an array with all the <name> contents.