Flatten an XML Schema

You can organize an XML schema on several levels linked by xs:include and xs:import statements. In some cases, working on such a schema as on a single file is more convenient.

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. This action is available from the contextual menu of the editor or from the Tools menu.

Figure: Flatten Schema Dialog Box

For the main schema file and for each imported schema, a new flattened schema is generated in the 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.
Note: You can choose the output folder and the name of each generated schema file.

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.

The following options are available in the Flatten Schema dialog box:
To flatten a schema from the command line, use the following command: The command line accepts the following parameters:

Command Line Example for Windows

flattenSchema.bat -in:http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd -outDir:mySchemas/flattened/xhtml -flattenImports:true -useCatalogs:true -flattenCatalogResolvedImports:true -verbose

Command Line Example for OS X

sh flattenSchemaMac.sh -in:http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd -outDir:mySchemas/flattened/xhtml -flattenImports:true -useCatalogs:true -flattenCatalogResolvedImports:true -verbose

Command Line Example for Unix/Linux

sh flattenSchema.sh -in:http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd -outDir:mySchemas/flattened/xhtml -flattenImports:true -useCatalogs:true -flattenCatalogResolvedImports:true -verbose