All of this makes new XML schemas nearly impossible to understand without a special documentation provided by their authors or, perhaps, generated by a special tool from the schemas themselves.
DocFlex/XML XSDDoc is one of such tools. It will decipher any XML schemas and represent them in the form of a beautiful clear-cut documentation (both multi-framed Javadoc-like HTML and printable RTF), which will help you to understand what those schemas actually describe.
If you are an XML schema author yourself, XSDDoc may be even more useful tool for you!
In fact, it may greatly help you to automat the process of documenting your XML schemas.
With this tool, you won't need anymore to write a separate documentation for every your XML schema.
Instead, using the
<xs:annotation>
elements, you can insert all your descriptions directly into the schemas themselves.
What is new now is that, along with the text, you can also insert the XHTML markup tags so as to format your descriptions in almost any imaginable way you wish:
<img> tags you can even insert
images directly into your XML schema annotations!
Since, according to the
W3C XML Schema specification, each
<xs:documentation>
element (where the annotation's text is exactly specified) is allowed to contain children from any other namespaces,
the XML schemas containing annotations preformatted with XHTML tags
will be the valid W3C XML schemas as well.
At the same time, such XML schemas could be processed by the “XSDDoc” templates into a splendid HTML or RTF documentation. What's more, using the Template Designer, you can easily customize such a generated documentation specifically for your requirements and needs.
The "XSDDoc" set of templates allows generation of the following types of documentation:
The entire HTML documentation is interconnected with a common network of hyperlinks. For instance, the documentation of a component declared in one schema will be hyperlinked from any other locations where that component is used or referred to in any other documented schemas.
The following screenshot shows such a documentation generated by 'XMLSchema.xsd'
using FramedDoc.tpl template (click on the picture to see the live HTML):
'XMLSchema.xsd' is the "XML Schema for XML Schemas",
the basic XML Schema that defines
the W3C XML Schema language itself
(see http://www.w3.org/2001/XMLSchema.xsd).
Similarly to the framed HTML, the RTF documentation is also entirely interconnected with hyperlinks. However, in addition to the interactive hyperlinks, many of them are duplicated with page number references, which may greatly help using/navigating such a documentation when it is printed out on the paper.
The following screenshots show pages of the RTF documentation generated by
the same 'XMLSchema.xsd' schema, however, now using PlainDoc.tpl template
(click on the picture to see the real size page preview):
![]() |
![]() |
![]() |
See also Examples | RTF Documentation for more details about that demo RTF and a lot more screenshots!
No Java code has been written anywhere specifically for the purpose of XML schema doc-generation! Neither any other XML processing technologies (e.g. XSL Transformations) are used anywhere in background!
Here is how the template looks when open in the Template Designer (click to see the full screenshot):
This picture shows the PlainDoc.tpl template open with the Template Designer under Linux and the generator dialog invoked to generate with this template a sample XML schema documentation in RTF format (click to see the full-size screenshot).
When no -nodialog option is specified on the command line, the generator launches automatically the following Generator Dialog:
In the Generator Dialog, you can:
Once you click the “Run” button, the dialog transforms itself to show the progress of the generation:
“XSDDoc” templates provide great a lot of parameters (> 170), which allow you to adjust the content (and some formatting) of the generated XML Schema documentation within a great range of details, starting from a few summaries and overviews up to the most comprehensive documentation containing every feature possible.
To handle such a lot of parameters the generator provides a GUI called Parameter Inspector. The inspector content is created dynamically from the parameter definitions found in the template.
The following screenshot shows the Parameter Inspector dialog of FramedDoc.tpl template (click on the picture to see a more expanded view):
In the Parameter Inspector you can:The parameters in inspector are organized in groups (which may contain subgroups and so on). A group heading may also be a parameter by itself.
Each parameter group may appear in expanded or collapsed state like a tree node. The group states are also saved in the generator.config file to be restored again when the inspector is invoked next time for the same templates.
Using inspector popup menu, you can quickly reset all parameters in a group to their default values:
What is more, you can combine interactive and command-line features together. Using -config option, you can provide on the command line a separate generator.config file, which will be used instead of the default one. With the Parameter Inspector you may interactively prepare all parameters needed for a specific kind of documentation. The parameters will be saved in this file. Further, you can use such a generator.config for generation (instead of specifying each time all needed parameter separately on the command line).
<xs:import>
and <xs:include>
elements and adding them for documenting (with possibility to download the imported schemas
directly from Internet by the URLs specified in those elements).
<xs:redefine>
elements are processed in the following way.
The XML schema specified in such an element is loaded into memory and then altered so that
every component being redefined within the
<xs:redefine>
element is renamed within the loaded schema by adding the '$ORIGINAL' suffix to the component's name.
All references to the original components within the
<xs:redefine>
element are also renamed. Further, the schema is processed the same way as in the case of
<xs:include>
element.
As a result, not only all the new semantics of the redefined components gets fully supported and documented but also the original components are preserved and documented as well.
For example, see
"XML Schemas for XHTML 1.1",
where
<xs:redefine>
elements are used in several locations.
Although, it sounds like nothing special, that feature appears to be so difficult to support that we have never seen it in any other existing XML schema doc-generators so far! Indeed, one needs to have some special technology to do that, because most of the standard means of processing XML (like XSL Transformations, for instance) completely hide the original namespace prefixes as the local thing of XML files. It may be irrelevant for most purposes, of course, but not for an XML documentation tool!
<xs:annotation>
elements, you can add descriptions both to your XML schema as a whole and, separately, to any components defined in it.
(Specifically, the description text must be enclosed in
<xs:documentation>
element, which, in turn, is nested in the
<xs:annotation>
element).
Click on the following link to see the documentation of
<xs:annotation>
element generated by its definition in the
"XML Schema for XML Schemas",
the basic XML schema defining the W3C XML Schema language itself.
|
Which <xs:annotation> elements are processed?
As you may notice, the
|
![]() |
![]() |
![]() |
For details, see FAQ | How to format my comments using XHTML?
Please, see FAQ | How to format my comments using XHTML? | How to insert images?
| Section | Component |
|---|---|
| Component Profile | All |
| XML Representation Summary | All |
| List of Content Elements | Element, Complex Type, Element Group |
| List of Containing Elements | Element |
| List of Direct Subtypes | Simple/Complex Type |
| List of Indirect Subtypes | Simple/Complex Type |
| List of All Based Elements | Simple/Complex Type |
| List of All Based Attributes | Simple Type |
| Usage Locations Report | All |
| Annotation | All |
| Type Definition Detail | Simple/Complex Type |
| Embedded Type Detail | Element, Attribute |
| XML Source | All |
| Attribute Detail | Element, Complex Type, Attribute Group |
| Content Element Detail | Element, Complex Type, Element Group |
Precisely, which sections are included for a particular component type can be controlled using template parameters. The following screenshots show samples of the Element and Simple Type Documentation, where all those sections are employed (click to view the HTML):
![]() |
![]() |
|
Here are more details The local elements are the element components defined within complex types (global or embedded in other elements) and within element groups (which are separate schema components that define the whole batches of elements arranged in certain complex models). The problem with local elements is that with their introduction there is no direct relation any more between an element name and its type for the whole XML document.
For example, when in an XML document you meet, for instance, an element
For all that trouble with their interpretation, local elements happen to be very much convenient and useful. Now, many XML schemas are designed so that the global elements are never used in them at all. Instead, the schema authors prefer to define only global data types and, then, refer to them from the local element definitions, occasionally modifying some global type within the types embedded in local elements. All of this does not eliminate the need to know what each local element describes and to have some documentation about it. That's especially true, because when you look at a particular XML document described by a schema, there is no type information shown nearby each element -- only element tags and that's all. The XSDDoc templates are designed to handle this problem in the following way:
|
Here is how such a representation may look:
Complex Content Models are represented using Kleene operators (those used in DTD) extended with two more operators to cover all situations allowed by W3C XML Schemas. The following table shows all operators used in Complex Content Model representations:
| Operator | Description |
|---|---|
| , | sequence |
| | | choice |
| () | grouping |
| ? | 0 or 1 times |
| + | 1 or more times |
| * | 0 or more times |
| Extended operators | |
| × |
The idea of this operator can be expressed by formula:
a × b = ((a, b) | (b, a)) This operator is used in two situations:
|
| [n1, n2] |
A general cardinality operator
(n1 can be 0 or any number; n2 is any number or *).
This operator is used in those rare situations when Kleene cardinality operators (?, +, *) are not enough. For example: A+ is the same as A[1,*] |
This is another tremendously helpful feature that we have never seen to be supported by any other XML Schema documentation generator so far!
In the case of a derivation by union, the full supertype tree is too complicated, so it is reduced to a formula that shows only the ancestor types used directly in the declaration of the given type:
<xs:annotation>
elements from the specific fragments of the reproduced XML source
(this is controlled by "Sections | XML Source | Remove Annotations"
template parameters group).
You may want to hide
<xs:annotation>
elements particularly when you are using XHTML
to format your descriptions. In that case, the reproduced
XHTML markup may occupy so much space, that it will overwhelm anything else.
(In addition, there is no much need to show it within XML source,
because all the annotation will be already present as a formatted text in the
"Annotation" section
of the component documentation).