parsing template file contents and creating node tree