Edit online

Flatten an XML Schema

You can organize an XML schema linked by <xs:include> and <xs:import> statements on several levels. In some cases, working on such a schema as if it were a single file is more convenient than working on multiple files separately. The Flatten Schema operation allows you to flatten an entire hierarchy of XML schemas. Starting with the main XML schema, Oxygen XML Editor calculates its hierarchy by processing the <xs:include> and <xs:import> statements.

The Flatten Schema action is available from the Tools menu or the contextual menu in Text mode. This action opens the Flatten Schema dialog box that allows you to configure the operation.

Figure 1. Flatten Schema Dialog Box
For the main schema file and for each imported schema, a new flattened schema is generated in the specified output folder. These schemas have the same name as the original ones.
Note: If necessary, the operation renames the resulted schemas to avoid duplicated file names.

A flattened XML schema is obtained by recursively adding the components of the included schemas into the main one. This means Oxygen XML Editor replaces the <xs:include>, <xs:redefine>, and <xs:override> elements with the ones coming from the included files.

Options in the Flatten Schema Dialog Box

The following options are available in the Flatten Schema dialog box:

File name
The name of the output file.
Output directory
The path of the output directory where the flattened schema file will be saved.
Open the flattened XML Schema file in editor
Opens the main flattened schema in the editing area after the operation completes.
Use the XML Catalogs when collecting the referenced XML Schemas
Enables the imported and included schemas to be resolved through the available XML Catalogs.
Note: Changing this option triggers the recalculation of the dependencies graph for the main schema.
Process the imported XML Schemas resolved through the XML Catalogs
Specifies whether or not the imported schemas that were resolved through an XML Catalog are also processed.
Flatten the imported XML Schema(s)
Specifies whether or not the imported schemas are flattened.
Note: For the schemas skipped by the flatten operation, no files are created in the output folder and the corresponding import statements remain unchanged.
Tip: This function can be executed from an automated command-line script, for more details, see Scripting Oxygen.