This method of the Document class retrieves the parent element. There is no parent element for the Document class, so this method always returns null.
public Element getParent();
Returns null.
getParent() in ElementImpl.