<oXygen/> XML Editor User Guide

Schema diagram

Introduction

<oXygen/> provides a simple, expressive and easy to read Schema Diagram View for XML Schema and Relax NG documents.

With this new feature you can easily develop complex schemas, print them on multiple pages or save them as JPEG, PNG and BMP images. It helps both schema authors in developing the schema and content authors that are using the schema to understand it.

<oXygen/> is the only XML Editor to provide a side by side source and diagram presentation and have them synchronized in real-time:

  • the changes you make in the Editor will immediately be visible in the Diagram (no background parsing).

  • changing the selected element in the diagram will select the underlaying code in the source editor.

When you create a new schema document or open an existing one the Editor Panel is splited in two sections: one containing the Schema Diagram and Components and the second the source code.

Figure 4.32. XML Schema editor - diagram and source

XML Schema editor - diagram and source

The Diagram View has two tabbed panes offering a Full Model View and a Logical Model View.

The Full Model View displays a graphical representation of the schema elements. You can expand the references to different components (for instance element or attribute references, base types, or in case of Relax NG schemas the pattern references).

The Logical Model View displays a diagram of the compiled schema. This is not synchronized automatically with the source editor and it is obtained after resolving the references, type extensions and type restrictions, redefinitions etc. in the case of XML Schemas and after applying the simplification rules in case of Relax NG schemas.

If the schema is not valid you will see an error message in the Logical Model View instead of the diagram.

Figure 4.33. Logical Model View for XML Schema

Logical Model View for XML Schema

At the top of the diagram view there are buttons corresponding to the following actions:

Expand to references

This option controls how the schema diagram is automatically expanded. For instance if you select it and then edit a top level element or you make a refresh, the diagram will be expanded until it reaches referred components. If this is left unchecked, only the first level of the diagram is expanded, showing the top level elements.

For large schemas, the editor disables this option automatically.

Refresh

Refreshes the Schema Diagram according to the changes in your code (changes in your imported documents or those that are not reflected automatically in the compiled schema)

Show/Hide Annotations

Depending on its state (selected/not selected), the documentation nodes are shown or hidden.

No selection update

When this button is selected the selection in the code doesn’t change the selection in the Full Model View

Selection update on document change

When this button is selected the selection in the Full Model View is changed only if you modify something in a different source element than the selected one.

Selection Update on caret move

When this button is selected the schema element where the caret is located determines the selection of the diagram element.

The Diagram View also contains a Schema Components View showing the global components grouped by their namespaces and types for XML Schemas and the patterns in case of Relax NG. It allows a quick access to a component by knowing its name.

The contextual menu offers quick access to the Print, Save as Image, Save Selection as Image and Refresh actions. The diagram can be saved as JPEG, PNG and BMP image.

XML Schema diagram

The Full Model View renders all the XML Schema elements with intuitive icons. The following references can be expanded in place: elements, attributes, groups, assigned types, base types, substitution elements and identity constraints. This coupled with the synchronization support makes the schema navigation easy.

The Logical Model View presents the global elements that when expanded show the types and identity constraints. If an element has a simple type then the type name is rendered. If an element has a complex type then the content type and attributes are presented.

The Schema Components View depends on the selected view: in Full Model View it contains the global elements, attributes, simple types, complex types, groups, attribute groups. In Logical Model View it contains the global elements, grouped by their namespaces.

Relax NG schema diagram

The Full Model View renders all the Relax NG elements with intuitive icons. The following references can be expanded in place: patterns, includes and external references.

Figure 4.34. Full Model View

Full Model View

The Logical Model View presents the compiled schema which is a single pattern. The patterns that form the element content are defined as a top level pattern with a generated name. The name is generated depending of the name class of the elements.

Figure 4.35. Logical Model View

Logical Model View

The Schema Components View presents a list with the patterns that appear in the diagram in both the Full Model View and Logical Model View cases.