Converting between schema languages
The Trang converter 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/> will generate
an approximation of the source schema.
The conversion functionality is available from
→ (Ctrl+Shift+\) and from the toolbar button
Trang Converter
A schema being edited can be converted with just one click on a toolbar button
if that schema can be the subject of a supported conversion.
The language of the target schema is specified with one of the four radio
buttons of the Output panel. The encoding, the maximum line
width and the number of spaces for one level of indentation can be also
specified in this panel.
The conversion can be further fine-tuned by specifying more advanced options
available from the Advanced options button. For example if
the input is a DTD and the output is an XML Schema the advanced options are:
For the Input panel:
- xmlns field
- specifies the default namespace, that is the namespace used for
unqualified element names.
- xmlns table
- Each row specifies in the prefix used for a namespace in the input
schema.
- colon-replacement
- Replaces colons in element names by the specified chars when
constructing the names of definitions used to represent the element
declarations and attribute list declarations in the DTD.
- 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.
- inline-attlist
- Specifies not to generate definitions for attribute list
declarations and 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.
- attlist-define
- This 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.
- 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.
- strict-any
- Preserves the exact semantics of ANY content models by using an
explicit choice of references to all declared elements. By default,
Trang uses a wildcard that allows any element.
- generate-start
- Specifies whether Trang should generate a start element. DTDs do
not indicate what elements are allowed as document elements. Trang
assumes that all elements that are defined but never referenced are
allowed as document elements.
- annotation-prefix
Default values are represented using an annotation attribute
prefix:defaultValue 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, Trang
will use a for prefix unless that conflicts with a prefix used in the
DTD.
For the Output panel:
- disable-abstract-elements
- Disables the use of abstract elements and subsitution 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).