Hi @phoeffler ,
Sorry for the delayed reply and thanks for your patience. The current options available can only extract XML metadata at the Feature Type (Feature Class table) level. Unfortunately there isn't currently a native option for reading metadata at the file geodatabase container level yet.
Since there doesn’t appear to be an existing FME Idea for this, I’d recommend submitting one and outlining your intended use cases. This allows other users to upvote, help raise visibility with our developers, and gauge interest for future support.
As a workaround, you can use ArcPy to access file geodatabase level metadata. As per Esri's documentation, the Metadata class exposes the XML via xml property so you can use PythonCaller transformers in FME to extract that metadata and write it back.
Note: This requires ArcGIS Pro installed on the same machine. You will also need to point FME's Python interpreter to ArcGIS Pro's Python environment under Workspace Parameters > Scripting > Python Compatibility > Esri ArcGis Python 3.x
| Read XML | Write/Save XML |
import fme from fme import BaseTransformer import fmeobjects import arcpy from arcpy import metadata as md
gdb_path = r'PATH TO YOUR GDB' gdb_md = md.Metadata(gdb_path)
class FeatureProcessor(BaseTransformer):
def input(self, feature: fmeobjects.FMEFeature): pass
def close(self): output = fmeobjects.FMEFeature() output.setAttribute('metadata_xml', gdb_md.xml)
self.pyoutput(output) | import fme from fme import BaseTransformer import fmeobjects import arcpy from arcpy import metadata as md
gdb_path = r'PATH TO YOUR GDB'
class FeatureProcessor(BaseTransformer):
def input(self, feature: fmeobjects.FMEFeature): gdb_md = md.Metadata(gdb_path) gdb_md.xml = feature.getAttribute('YOUR XML ATTRIBUTE NAME') gdb_md.save() self.pyoutput(feature)
def close(self): pass |
- Replace gdb_path with your geodatabase path.
| - Replace gdb_path with your geodatabase path.
- Replace feature.getAttribute(“”) with the attribute containing your updated XML.
|
The first PythonCaller should output a metadata_xml attribute containing the file geodatabase level metadata. From there, you can follow the article you linked and use XML transformers such as XMLFormatter or XMLUpdater to modify the XML. Once you're done, a second PythonCaller can write the updated XML back to the geodatabase.
For more details, I'd recommend referring to Esri's documentation on the Metadata class. Hope this helps!