Okay, I'll bite...this has nothing to do with TestNG.
That being said the locator "link=Companies" is more robust assuming the text "Companies" is unique to that link on that page.
The XPATH "//table[@id='maincontent']/tbody/tr/td[3]/table[2]/tbody/tr[2]/td/a[2]" is highly brittle, particularly if you have dynamic elements in the page.
A more robust XPATH would be "//a[.='Companies']" assuming again that "Companies" is a unique value for a link. A better and more robust way is to target the element by using a unique attribute such as an id or name.
"name=companies_link" or "id=company_link" which in XPATH form would look like: "//a[@id='company_link']" or "//a[@name='company_link']"
You should not assume the code exported from the SeleniumIDE can be run directly and only use it as a template/guide. SeleniumIDE should only be used as a quick demo tool or debug tool. Use your brain when determining the most robust location mechanism for a given element.
--