Find and replace xml tags. See details in code