fix(checkName): Check for wellformed logical names (closes #4988)

Make CheckDoc::checkName() and Doc::setLogicalName() use the same
definition of a well-formed logical name.