Hi, I need to routinely export two feature datasets to xml workspace docs. I found the following code that exports the first dataset found in the workspace, but don't know how to use the names enumerator to get a specific dataset by name: Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")
Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)
Dim workspace As IWorkspace = workspaceFactory.OpenFromFile(sdeconnPath, 0)
Dim workspaceDataset As IDataset = CType(workspace, IDataset)
Dim workspaceName As IName = workspaceDataset.FullName()
'Retrieve the first feature dataset from the workspace.
Dim enumDatasetName As IEnumDatasetName = workspace.DatasetNames(esriDatasetType.esriDTFeatureDataset)
enumDatasetName.Reset()
Dim featureDatasetName As IName = CType(enumDatasetName.Next(), IName)
If featureDatasetName Is Nothing Then
Throw New Exception("No feature datasets exist in the specified geodatabase.")
End If
' Create a new names enumerator and add the feature dataset name.
Dim enumNameEdit As IEnumNameEdit = New NamesEnumerator()
enumNameEdit.Add(featureDatasetName)
Dim enumName As IEnumName = CType(enumNameEdit, IEnumName)
' Create a GeoDBDataTransfer object and create a name mapping.
Dim geoDBDataTransfer As IGeoDBDataTransfer = New GeoDBDataTransfer()
Dim enumNameMapping As IEnumNameMapping = Nothing
geoDBDataTransfer.GenerateNameMapping(enumName, workspaceName, enumNameMapping)
' Create an exporter and export the dataset with binary geometry, not compressed,
' and including metadata.
Dim gdbXmlExport As IGdbXmlExport = New GdbExporter()
gdbXmlExport.ExportDatasets(enumNameMapping, outputXmlFile, True, False, True)
End Sub
What I would like to do is export a dataset called "Features" and a dataset called "Network" into a single xml workspace doc. Any help would be very much appreciated.. Thanks