This method of the Document class sets the Document back to its initial empty state retaining only the ElementFactory association.
public void clear();