Export XML Workspace Document (Data Management)

Summary

Creates a readable XML document of the geodatabase contents.

The XML workspace document is useful for sharing geodatabase schemas or copying geodatabase schemas from one type to another.

Usage

  • The output can be created as an .xml file or as a compressed .zip file that contains the .xml file. To create an .xml file, name the output file using the .xml extension. To create a compressed .zip file, name the output file using the .zip or .z extension.

  • Caution:
    The output XML workspace document can be very large when you copy both the data and the schema. Generally, this is not recommended for copying geodatabase data. Alternatives for copying geodatabase data include using the Copy tool or the Clip tool to extract subsets of the data. In addition, the Package toolset contains tools that consolidate, package, and share layers, map documents, address locators, and geoprocessing results.
  • If the input is a geodatabase or a feature dataset, all data elements contained in that workspace will be exported. If you only want to export a subset of data elements to an file, you must copy them to a new geodatabase to be exported.

  • If you export a feature class in a network, topology, relationship class, or terrain, all the feature classes participating in the network, topology, relationship class, or terrain will also be exported.

  • Attribute rules and any sequences referenced in the attribute rule script expression will be included in the export.

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

Parameters

LabelExplanationData Type
Input Data

The input datasets that will be exported and represented in an XML workspace document. The input data can be a geodatabase, feature dataset, feature class, table, raster, or raster catalog. If there are multiple inputs, the inputs must be from the same workspace. Multiple input workspaces are not supported.

Feature Class; Feature Dataset; Raster Dataset; Table; Workspace
Output File

The XML workspace document file that will be created. The output can be XML (with an .xml file extension) or compressed XML (with a .zip or .z file extension).

File
Export Options
(Optional)

Specifies whether the output XML workspace document will contain all of the data from the input (table and feature class records, including geometry) or only the schema.

  • DataThe schema and the data will be exported. This is the default.
  • Schema onlyOnly the schema will be exported.
String
Storage Type
(Optional)

Specifies how feature geometry will be stored when data is exported from a feature class.

  • BinaryThe geometry will be stored in a compressed base64 binary format. This binary format will produce a smaller XML workspace document. Use this option when the XML workspace document will be read by a custom program that uses ArcObjects. This is the default.
  • NormalizedThe geometry will be stored in an uncompressed format. Using this option will result in a larger file. Use this option when the XML workspace document will be read by a custom program that does not use ArcObjects.
String
Export Metadata
(Optional)

Specifies whether the metadata will be exported.

  • Checked—If the input contains metadata, it will be exported. This is the default.
  • Unchecked—Metadata will not be exported.
Boolean

arcpy.management.ExportXMLWorkspaceDocument(in_data, out_file, {export_type}, {storage_type}, {export_metadata})
NameExplanationData Type
in_data
[in_data,...]

The input datasets that will be exported and represented in an XML workspace document. The input data can be a geodatabase, feature dataset, feature class, table, raster, or raster catalog. If there are multiple inputs, the inputs must be from the same workspace. Multiple input workspaces are not supported.

Feature Class; Feature Dataset; Raster Dataset; Table; Workspace
out_file

The XML workspace document file that will be created. The output can be XML (with an .xml file extension) or compressed XML (with a .zip or .z file extension).

File
export_type
(Optional)

Specifies whether the output XML workspace document will contain all of the data from the input (table and feature class records, including geometry) or only the schema.

  • DATAThe schema and the data will be exported. This is the default.
  • SCHEMA_ONLYOnly the schema will be exported.
String
storage_type
(Optional)

Specifies how feature geometry will be stored when data is exported from a feature class.

  • BINARYThe geometry will be stored in a compressed base64 binary format. This binary format will produce a smaller XML workspace document. Use this option when the XML workspace document will be read by a custom program that uses ArcObjects. This is the default.
  • NORMALIZEDThe geometry will be stored in an uncompressed format. Using this option will result in a larger file. Use this option when the XML workspace document will be read by a custom program that does not use ArcObjects.
String
export_metadata
(Optional)

Specifies whether the metadata will be exported.

  • METADATAIf the input contains metadata, it will be exported. This is the default.
  • NO_METADATAMetadata will not be exported.
Boolean

Code sample

ExportXMLWorkspaceDocument example 1 (Python window)

The following Python window script demonstrates how to use the ExportXMLWorkspaceDocument function in immediate mode.

import arcpy
arcpy.management.ExportXMLWorkspaceDocument('c:/data/StJohns.gdb', 
                                            'c:/data/StJohns.xml', 
                                            'SCHEMA_ONLY', 'BINARY', 'METADATA')
ExportXMLWorkspaceDocument example 2 (stand-alone script)

The following Python script demonstrates how to use the ExportXMLWorkspaceDocument function in a stand-alone script.

# Name: ExportXMLWorkspaceDocument.py
# Description: Export the contents of my geodatabase to an XML workspace document. 

# Import system modules
import arcpy

# Set local variables
in_data = 'c:/data/StJohns.gdb'
out_file = 'c:/data/StJohns.xml'
export_option = 'SCHEMA_ONLY'
storage_type = 'BINARY'
export_metadata = 'METADATA'

# Run ExportXMLWorkspaceDocument
arcpy.management.ExportXMLWorkspaceDocument(in_data, out_file, export_option, 
                                            storage_type, export_metadata)

Licensing information

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

Related topics