Refactored FluentDOM\Nodes\Builder::getXmlFragment()/getHtmlFragment(), extract method