Added support for self-closing tags and customRoots