Improve splitTocEntry method

It will take the first and last items in the TOC entry with space as
separating character as the hierarchy level and page number respectively.
Invalid item will be reported.