get main domain according to the document