Edit online

Converting Schema to Another Schema Language

The Generate/Convert Schema tool allows you to convert a DTD or Relax NG (full or compact syntax) schema or a set of XML files to an equivalent XML Schema, DTD or Relax NG (full or compact syntax) schema. Where perfect equivalence is not possible due to limitations of the target language, Oxygen XML Developer Eclipse plugin generates an approximation of the source schema. Oxygen XML Developer Eclipse plugin uses the Trang multiple format converter to perform the actual schema conversions.

To use this tool, select the Generate/Convert Schema (Ctrl + Shift + BackSlash (Command + Shift + BackSlash on macOS)) action from the XML Tools menu. This action opens the Generate/Convert Schema dialog box that allows you to configure various options for conversion.

Figure 1. Generate/Convert Schema Dialog Box
The Generate/Convert Schema dialog box includes the following options:
Input section
Allows you to select the language of the source schema. If the conversion is based on a set of XML files, rather than just a single XML file, select the XML Documents option and use the file selector to add the XML files involved in the conversion.
Output section

Allows you to select the language of the target schema.

Options
You can choose the Encoding, the maximum Line width, and the Indent size (in number of spaces) for one level of indentation.
Output file
Specifies the path for the output file that will be generated.
Close dialog when finished
If you deselect this option, the dialog box will remain open after the conversion so that you can easily continue to convert more files.
Advanced options

If you select XML 1.0 DTD for the input, you can click this button to access more advance options to further fine-tune the conversion. The following advanced options are available:

XML 1.0 DTD Input section
These options apply to the source DTD:
  • xmlns - Specifies the default namespace, that is the namespace used for unqualified element names.
  • attlist-define - Specifies how to construct the name of the definition representing an attribute list declaration from the name of the element. The specified value must contain exactly one percent character. This percent character is replaced by the name of element (after colon replacement) and the result is used as the name of the definition.
  • colon-replacement - Replaces colons in element names with the specified chars when constructing the names of definitions used to represent the element declarations and attribute list declarations in the DTD.
  • any-name - Specifies the name of the definition generated for the content of elements declared in the DTD as having a content model of ANY.
  • element-define - Specifies how to construct the name of the definition representing an element declaration from the name of the element. The specified value must contain exactly one percent character. This percent character is replaced by the name of element (after colon replacement) and the result is used as the name of the definition.
  • annotation-prefix - Default values are represented using a @prefix:defaultValue annotation attribute where prefix is the specified value and is bound to http://relaxng.org/ns/compatibility/annotations/1.0 as defined by the RELAX NG DTD Compatibility Committee Specification. By default, the conversion engine will use a for prefix unless that conflicts with a prefix used in the DTD.
  • inline-attlist - Instructs the application not to generate definitions for attribute list declarations, but instead move attributes declared in attribute list declarations into the definitions generated for element declarations. This is the default behavior when the output language is XSD.
  • strict-any - Preserves the exact semantics of ANY content models by using an explicit choice of references to all declared elements. By default, the conversion engine uses a wildcard that allows any element
  • generate-start - Specifies whether or not the conversion engine should generate a start element. DTD's do not indicate what elements are allowed as document elements. The conversion engine assumes that all elements that are defined but never referenced are allowed as document elements.
  • xmlns mappings table - Each row specifies the prefix used for a namespace in the input schema.
W3C XML Schema Output section
This section is available if you select W3C XML Schema for the output.
  • disable-abstract-elements - Disables the use of abstract elements and substitution groups in the generated XML Schema. This can also be controlled using an annotation attribute.
  • any-process-contents - One of the values: strict, lax, skip. Specifies the value for the @processContents attribute of any elements. The default is skip (corresponding to RELAX NG semantics) unless the input format is DTD, in which case the default is strict (corresponding to DTD semantics).
  • any-attribute-process-contents - Specifies the value for the @processContents attribute of <anyAttribute> elements. The default is skip (corresponding to RELAX NG semantics).