break off xml tag parsing into separate function