Using tree.iter() command to extract element tags for refs