Editing Relax NG schemas

<oXygen/> provides a special type of editor for Relax NG schemas. This editor presents the usual text view of an XML document synchronized in real time with a graphical view of the schema components.

Relax NG schema diagram

Introduction

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

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.

Full model view

When you create a new schema document or open an existing one the Editor Panel is divided in two sections: one containing the Schema Diagram and the second the source code. The Diagram View has two tabbed panes offering a Full Model View and a Logical Model View.

Figure 4.43. Relax NG schema editor - full model view

Relax NG schema editor - full model view

The Full Model View renders all the XML Schema elements with intuitive icons. The following references can be expanded in place: patterns, includes and external references. This coupled with the synchronization support makes the schema navigation easy.

All the element and attribute names are editable: double-click on any name to start editing it.

Logical 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.44. Logical Model View for a Relax NG schema

Logical Model View for a Relax NG 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.

Show/Hide Annotations

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

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)

Print

Prints the diagram. <oXygen/> will split and print your Schema on multiple pages if it is a large document. Each page will be surrounded with a frame and will contain information about the neighboring pages.

Save as Image

Saves the Schema Diagram as a JPEG Image.

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

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

Schema components 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. It allows a quick access to a component by knowing its name. It can be opened from Window->Show View->Other->oXygen->Schema Components

Figure 4.45. Schema components view for Relax NG

Schema components view for Relax NG

Relax NG editor specific actions

The list of actions specific for the Relax NG (full syntax) editor of <oXygen/> is:

  • contextual menu of current editor->Show Definition : move the cursor to the definition of the current element in this Relax NG (full syntax) schema.

Search References and Declarations

All the following actions can be applied on ref and parentRef parameters only.

  • RNG+ ->References in Project (Ctrl+Shift+R): Searches in the project all references of the item found at current cursor position.

  • contextual menu of current editor+Search->References in File: Searches in the current file all references of the item found at the current cursor position.

  • contextual menu of the current editor+Search->References Starting from File: Searches all references of the item at the cursor position in the current edited file and all its included and imported files.

  • contextual menu of the current editor+Search->References Starting from...: Opens a dialog that allows the user to specify the list of files used to start searching from. Pressing OK begins searching all references of the item at the cursor position in the selected files and their included and imported files.

All the following actions can be applied on named define parameters only.

  • RNG+ ->Declarations in Project (Ctrl+Shift+D): Searches in the project all declarations of the item found at current cursor position.

  • contextual menu of current editor+Search->Declarations in File: Searches in the current file all declarations of the item at the current cursor position.

  • contextual menu of the current editor+Search->Declarations Starting from File: Searches all declarations of the item at the cursor position in the current edited file and all its included and imported files.

  • contextual menu of the current editor+Search->Declarations Starting from...: Opens the Start locations dialog that allows the user to specify the list of files used to start searching from. Pressing OK begins searching all declarations of the item at the cursor position in the selected files and all their included and imported files.

  • XSL->Occurrences in File (Ctrl+Shift+U): Searches all occurrences of the item at the caret position in the currently edited file.