def updateTableDom(dom,fc,logFile):
    #def __updateTable(domMR,fc,gdbFolder,titleSuffix,logFile,isAnno):
    #try to export metadata from fc
    desc = arcpy.Describe(fc)
    if desc.datasetType == 'FeatureClass' and desc.FeatureType == 'Annotation':
        isAnno = True
    else: isAnno = False 
    if entityDict.has_key(fc):
        hasDesc = True
        descText = entityDict[fc]
        descSourceText = ncgmp
    else:
        hasDesc = False
        if not isAnno:
            descText = '**Need Description of '+fc+'**'
            descSourceText = '**Need Description Source**'
            logFile.write('No description for entity '+fc+'\n')
            logFile.write('No description source for entity '+fc+'\n')

    eainfo = dom.getElementsByTagName('eainfo')[0]
    # DELETE EXISTING CHILD NODES
    while len(eainfo.childNodes) > 0:
        eainfo.removeChild(eainfo.lastChild)
    if isAnno:
        if hasDesc: eaoverText = descText
        else: eaoverText = 'annotation feature class'
        if hasDesc: edcTxt = descSourceText
        else: edcTxt = 'See ESRI documentation for structure of annotation feature classes.'
        # add overview to dom
        dom = eaoverviewDom(dom,eainfo,eaoverText,edcTxt)
        
        #overview = dom.createElement('overview')
        #eaover = __newElement(dom,'eaover',eaoverText)
        #overview.appendChild(eaover)
        #eadetcit = __newElement(dom,'eadetcit',edcTxt)
        #overview.appendChild(eadetcit)
        #eainfo.appendChild(overview)
    else:  # is table or non-Anno feature class
        # check for e-a detailed node, add if necessary
        if len(eainfo.getElementsByTagName('detailed')) == 0:
            #add detailed/enttyp/enttypl nodes
            detailed = dom.createElement('detailed')
            enttyp = dom.createElement('enttyp')
            enttypl = __newElement(dom,'enttypl',fc)
            enttypd = __newElement(dom,'enttypd',descText)
            enttypds = __newElement(dom,'enttypds',descSourceText)
            for nd in enttypl,enttypd,enttypds:
                enttyp.appendChild(nd)
            detailed.appendChild(enttyp)
            eainfo.appendChild(detailed)
            
        ##check that each field has a corresponding attr node
        #get a list of the field names in the fc
        fldNameList = __fieldNameList(fc)    
        #get list of attributes in this metadata record
        #  we assume there eainfoNode has only one 'detailed' child
        attrlablNodes = eainfo.getElementsByTagName('attrlabl')
        attribs = []
        detailed = dom.getElementsByTagName('detailed')[0]
        for nd in attrlablNodes:
            attribs.append(nd.firstChild.data)
        for fieldName in fldNameList:
            if not fieldName in attribs:
                attr = dom.createElement('attr')
                attrlabl = __newElement(dom,'attrlabl',fieldName)
                attr.appendChild(attrlabl)
                detailed.appendChild(attr)                
        #update the entity description and entity description source
        if entityDict.has_key(fc) or ( fc[0:2] == 'CS' and entityDict.has_key(fc[2:]) ):
            enttypl = dom.getElementsByTagName('enttypl')
            if len(enttypl) > 0:
                enttyp = enttypl[0].parentNode
                # entity description node
                if fc[0:2] == 'CS':
                    descriptionText = entityDict[fc[2:]]
                else:
                    descriptionText = entityDict[fc]
                newEnttypd = __newElement(dom,'enttypd',descriptionText)
                __appendOrReplace(enttyp,newEnttypd,'enttypd')
                # entity description source node
                newEnttypds = __newElement(dom,'enttypds',ncgmp)
                __appendOrReplace(enttyp,newEnttypds,'enttypds')                           
        #update attribute descriptions and value domains
        dom = __updateEntityAttributes(fc, fldNameList, dom, logFile)
    return dom
    dom = updateTableDom(dom,aTable,logFile)    
    addMsgAndPrint('  Importing XML to metadata for table '+aTable)
    writeDomToFile(dom,revisedMetadata)
    arcpy.ImportMetadata_conversion(revisedMetadata,'FROM_FGDC',inGdb+'/'+aTable,'ENABLED')

# import to feature datasets and constituent feature classes
arcpy.env.workspace = inGdb
fds = arcpy.ListDatasets('','Feature')
for anFds in fds:
    revisedMetadata = gdb+'-'+anFds+'.xml'
    addMsgAndPrint('  Creating XML for '+anFds)
    dom = xml.dom.minidom.parse(xmlFileMR)
    dom = titleSuffix(dom,': feature dataset '+anFds)
    supplementaryInfo = 'Feature dataset '+anFds+gdbDesc0b+gdbDesc1+gdbDesc2
    dom = addSupplinf(dom,supplementaryInfo)
    if entityDict.has_key(anFds):
        overText = entityDict[anFds]
        overSrc = ncgmp
    elif anFds.find('CrossSection') == 0:
        overText = entityDict['CrossSection']
        overSrc = ncgmp
    else:
        overText = '**Need Description of '+anFds+'**'
        overSrc = '**Need Description Source**'
        logFile.write('No description for entity '+anFds+'\n')
        logFile.write('No description source for entity '+anFds+'\n')
    eainfo = dom.getElementsByTagName('eainfo')[0]
    dom = eaoverviewDom(dom,eainfo,overText,overSrc)
    addMsgAndPrint('  Importing XML to metadata for '+anFds)
    writeDomToFile(dom,revisedMetadata)
    arcpy.ImportMetadata_conversion(revisedMetadata,'FROM_FGDC',inGdb+'/'+anFds,'ENABLED')