'Create the document root'

def insertRoot(self, token):

    docStr = u''
    if self.doctype:
        assert self.doctype.name
        docStr += (u'<!DOCTYPE    %s' % self.doctype.name)
        if ((self.doctype.publicId is not None) or (self.doctype.systemId is not None)):
            docStr += (u'    PUBLIC    "%s"    ' % self.infosetFilter.coercePubid((self.doctype.publicId or u'')))
            if self.doctype.systemId:
                sysid = self.doctype.systemId
                if ((sysid.find(u"'") >= 0) and (sysid.find(u'"') >= 0)):
                    warnings.warn(u'DOCTYPE    system    cannot    contain    single    and    double    quotes', DataLossWarning)
                    sysid = sysid.replace(u"'", u'U00027')
                if (sysid.find(u"'") >= 0):
                    docStr += (u'"%s"' % sysid)
                else:
                    docStr += (u"'%s'" % sysid)
            else:
                docStr += u"''"
        docStr += u'>'
        if (self.doctype.name != token[u'name']):
            warnings.warn(u'lxml    cannot    represent    doctype    with    a    different    name    to    the    root    element', DataLossWarning)
    docStr += u'<THIS_SHOULD_NEVER_APPEAR_PUBLICLY/>'
    root = etree.fromstring(docStr)
    for comment_token in self.initial_comments:
        comment = self.commentClass(comment_token[u'data'])
        root.addprevious(comment._element)
    self.document = self.documentClass()
    self.document._elementTree = root.getroottree()
    name = token[u'name']
    namespace = token.get(u'namespace', self.defaultNamespace)
    if (namespace is None):
        etree_tag = name
    else:
        etree_tag = (u'{%s}%s' % (namespace, name))
    root.tag = etree_tag
    root_element = self.elementClass(name, namespace)
    root_element._element = root
    self.document._childNodes.append(root_element)
    self.openElements.append(root_element)
    self.insertComment = self.insertCommentMain
