TemplateParser: add detection of void elements and empty elements