Exporting SDE Schema to XML

912
1
04-13-2012 01:35 PM
StacieMcGahey
New Contributor III
I'm trying to create an XML schema document from an SDE database (I'm trying to do this http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#//0093000000sz... programatically).  I used the example code http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_export_a_dataset..., but I keep getting the attached error at this line:
geoDBDataTransfer.GenerateNameMapping(enumName, workspaceName, enumNameMapping)


I think it may have to do with Dataset.Fullname not being populated with SDE data, but I don't know. 

Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")
Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)
Dim workspace As IWorkspace = workspaceFactory.OpenFromFile(fileGdbPath, 0)
Dim workspaceDataset As IDataset = CType(workspace, IDataset)
Dim workspaceName As IName = workspaceDataset.FullName


Does anyone have some insight as to what I'm doing wrong, and how to make it work for an SDE database?  It works just fine with a file geodatabase.

Thanks,
Stacie
[ATTACH=CONFIG]13516[/ATTACH]
0 Kudos
1 Reply
StacieMcGahey
New Contributor III
I did open the SDE workspace correctly.  The code should be:
      Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")
      Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)
      Dim pPropset As IPropertySet
      pPropset = New PropertySet

      With pPropset
        .SetProperty("Server", "******")
        .SetProperty("Instance", "*******")
        .SetProperty("Database", "*****") ' Ignored with ArcSDE for Oracle 
        .SetProperty("AUTHENTICATION_MODE", "OSA")
        .SetProperty("version", "dbo.DEFAULT")
      End With

      Dim workspace As IWorkspace = workspaceFactory.Open(pPropset, 0)


I actually already have a reference to the workspace I want to pass to the sub, and that's gives me the same error.
0 Kudos