Import XML Workspace Document (Data Management)

License Level:BasicStandardAdvanced

Summary

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

Learn more about copying a schema using XML workspaces

Learn more about Geodatabase XML

Usage

Syntax

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

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

Workspace
in_file

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.

File
import_type
(Optional)

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.
String
config_keyword
(Optional)

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

String

Code Sample

ImportXMLWorkspaceDocument example 1 (Python window)

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

import arcpy
arcpy.ImportXMLWorkspaceDocument_management("C:/Data/Target.gdb", "C:/Data/StJohnsData.xml", "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: ImportXMLWorkspaceDocument.py
# 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, config_keyword)

Environments

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015