ArcObjects Library Reference  (GeoDatabaseDistributed)    

ExportWorkspace Example

[Visual Basic 6.0]

'*** The following example allows you to export the workspace from a pgdb to an xml file. ***

'*** This requires an ArcGIS License and you will need to initialize the AoInitialize CoClass ***


Private Sub ExportWS(db As String, XmlFile As String)

Dim pWSF As IWorkspaceFactory
Set pWSF = New AccessWorkspaceFactory
  
'*** Open PGDB ***
Dim pWS As IWorkspace
Set pWS = pWSF.OpenFromFile(db, 0)
  
'*** Create Exporter ***
Dim pExporter As IGdbXmlExport
Set pExporter = New GdbExporter
  
'*** Export WS to XML in normalized format and not compressed ***
pExporter.ExportWorkspace pWS, XmlFile, False, False, True
 
End Sub

'*** Create a commandbutton and copy/paste following code. ***
 

Private Sub cmdExportWS_Click()
  
Me.MousePointer = vbHourglass
 
'*** Location of PGDB ***

Dim db As String
db = App.Path + "\GN.mdb"

'*** Location of xml file ***

Dim XmlFile As String
XmlFile = App.Path + "\GN.xml"
  
ExportWS db, XmlFile
      
MsgBox "Exported Geodatabase Workspace to XML.", vbInformation

End Sub


[Visual Basic .NET, C#, C++]
No example is available for Visual Basic .NET, C#, or C++. To view a Visual Basic 6.0 example, click the Language Filter button Language Filter in the upper-left corner of the page.