Import XML Workspace Document (Data Management)

Available with Standard or Advanced license.


Imports the contents of an XML workspace document into an existing geodatabase.


  • The Target Geodatabase must already exist and can be a personal, file, or enterprise geodatabase. To create a new, empty geodatabase use the Create File GDB tool.

  • If you are importing into a file or enterprise geodatabase and want to use a configuration keyword, you can choose one from the Configuration Keyword drop-down list on the tool dialog box. In a Python script, you will need to know the name of the configuration keyword to use.

  • If the Overwrite output checkbox in the Project properties is unchecked and a data element from the input XML workspace document has the same name as a data element in the Target Geodatabase, the data element will be imported with a new unique name. If this option is checked, existing datasets will be overwritten. To find the Overwrite output checkbox, click the Project tab and click Options. In the Options dialog box, click the Geoprocessing tab.

  • The tool messages will include the list of data element names that were imported.


ImportXMLWorkspaceDocument(target_geodatabase, in_file, {import_type}, {config_keyword})
ParameterExplanationData Type

The existing geodatabase where the contents of the XML workspace document will be imported.


The input XML workspace document file containing geodatabase contents to be imported. This can be an XML file (.xml) or a compressed ZIP file (.zip or .z) containing the XML file.


Determines if both data (feature class and table records, including geometry) and schema are imported, or only schema is imported.

  • DATAImport the data and schema. This is the default.
  • SCHEMA_ONLYImport the schema only.

Geodatabase configuration keyword to be applied if the Target Geodatabase is an enterprise or file geodatabase.


Derived Output

NameExplanationData Type

The updated geodatabase.


Code sample

ImportXMLWorkspaceDocument example 1 (Python window)

The following Python window script demonstrates how to use the ImportXMLWorkspaceDocument tool in immediate mode.

import arcpy
                                            "SCHEMA_ONLY", "DEFAULTS")
ImportXMLWorkspaceDocument example 2 (stand-alone script)

The following Python script demonstrates how to use the ImportXMLWorkspaceDocument tool in a stand-alone script.

# Name:
# Description: Imports the contents of an XML workspace document into a target 
#              geodatabase. 

# Import system modules
import arcpy

# Set local variables
target_gdb = "c:/data/Target.gdb"
in_file = "c:/data/StJohnsData.xml"
import_type = "SCHEMA_ONLY"
config_keyword = "DEFAULTS"

# Execute ImportXMLWorkspaceDocument
arcpy.ImportXMLWorkspaceDocument_management(target_gdb, in_file, import_type, 

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics