Intelligent XML Editing

Context Sensitive Content Assistant

<oXygen/> offers the list of elements, attributes and attribute values through a content completion assistant. Unlike other editors that offer all the available entries, for example all the element names defined by the document XML Schema, <oXygen/> shows only those entries valid in the editing context. In this way the XML document is kept valid most of the time and the user does not have to know about the relations between elements.

In the following sample you can see that the list of possible elements for "tgroup" element contains "colspec", "tbody" and "thead" which is exactly what the DocBook DTD has defined.

Content completion

Support for Showing Recent Content Items

The proposals that are actually used by the user are promoted at the top of the content completion list thus making their reuse easy.

For example, when editing an XSLT stylesheet, you are using a small fraction from all the set of XSLT and HTML elements. By placing the recent ones up in the list, it is faster to find them next time you want to use them.

In the next image you can see that the four XSLT elements were moved above the ones from the XHTML grammar.

Recent Content Items

Support for Learning Words

You need to turn this on as it is disabled by default. All the words in the document will be indexed as they are written. When you enter a word prefix and press CTRL+Space all the words starting with that prefix are presented through the content completion window.

Learning Words

Content Assistant for Documents Without a Schema

If there is a schema associated to the edited document then <oXygen/> will analyze it and initialize the content assistant.

In case the document has no associated schema then the content completion is initialized by examining the edited document and by learning its structure. Another way is for one to specify in the options the default XML Schema or DTD to be used.

Note that the learned structure can be saved to a DTD file and can be used as a skeleton for further development.

Configurable Content Assistant Behaviour

There are many settings that customize the operating mode of the content assistant. For example you can enable or disable the generation of the required content or modify the way the cursor is positioned after an insertion.

XML Content Completion

Content Completion for IDREFS

Content Completion for IDRREFS

<oXygen/> will present the ID values collected in the last validate action on the content completion proposals where an IDREF or an IDREFS type is specified. This works not only with documents that have an associated DTD but also with documents that have an XML Schema or a Relax NG schema associated.

In the following sample you can see the content completion list containing all the IDs displayed when creating a link. The attribute "linkend" is defined as IDREF (a reference to an ID value). The document has associated the DocBook DTD.

IDREFs Content Completion

When an attribute value is of type anyURI (in both XML Schema and Relax NG schema) <oXygen/> will present proposals of the form #ID for each defined ID value in the document.

Search/Refactoring Support for ID/IDREFS

<oXygen/> offers support for search and refactoring operations for ID/IDREFS for XML documents that have an associated DTD, XML Schema, or Relax NG Schema. These operations are available in the Text mode also in the Author mode.

In Text mode, the easiest way to access the search/refactoring action if by using the Quick Assist support. It is available when you position the caret inside an ID or an IDREF. To access the Quick Assist actions, click the yellow light bulb from the line-number stripe.

Enumeration Content Completion

Highlight IDs Occurrences in Text Mode

To see the occurrences of an ID in an XML document in the Text mode, place the cursor inside the ID declaration or reference. The occurrences are marked in the vertical side bar at the right of the editor. Click a marker on the side bar to navigate to the occurrence that it corresponds to. The occurrences are also highlighted in the editing area.

Enumeration Content Completion

Support for the Enumerations

The Content Assistant offers proposals for attributes and elements values that have as type an enumeration of tokens. This is available for documents that make use of XML Schema or Relax NG Schema.

In the next image the attribute "list" of "root" has been defined as a list of decimal values: 1.44, 2.88, 3 and 5.

Enumeration Content Completion

Automatic Generation of Required Content

To speed up the content creation <oXygen/> automatically inserts the required attributes of an element and also the required element content of the inserted element. In the following example you can see how an entire subtree is generated just by selecting an element. You will create valid content with minimum effort!

Generate the required element attributes and content

Code Templates

Code Templates

Document fragments can be defined and reused while editing. The template list can be obtained by using the Content Completion on request shortcut (CTRL-SPACE). <oXygen/> comes with a large number of ready-to use templates for XSLT and XML Schema.

For example in the following image you can see how the "copy template" has been defined. After insertion the caret will be positioned after the line of the "xsl:template" closing tag.

XSLT Code Templates

The templates can be shared using the export/import actions.

XML Markup Contrast Adjuster

The contrast control button allows you to change the transparency levels for XML markup or text. This way you can change the focus of attention from markup to text and vice versa. The transparent markup option combined with locking the tags can be used for safe and easy editing!

Contrast control

Resource Hierarchy / Dependencies View

The relationship between XML resources that are referred using the XInclude and External Entity mechanisms can be visualized and understood with the help of the Resource Hierarchy/Dependencies View.

XML Resource Hierarchy

Update References of the Moved or Renamed Resource(s)

When an XML resource is renamed or moved in the Project view, <oXygen/> gives you the option to update the resource's references. The same option is available when you move or rename a resource from the Resource Hierarchy/Dependencies view.

Update References of the Moved or Renamed Resource(s)

Matching Tag Highlight and Navigation

When having the cursor inside a tag name both the start-tag and the end-tag are underlined in order to provide immediate focus on the current element. You can move the cursor to the matching tag using an action from the popup menu.

Matching tag

Automatic editing of the matching end tag

It is a lot easy to rename elements in <oXygen/>. When the start tag of an XML element is edited then the matching end tag is automatically changed thus keeping the XML document well formed and saving you a few keystrokes. This behavior is controlled from the user preferences.

Lock/Unlock XML Tags

This is very useful when you edit forms like XML documents or XML templates. This way you can protect the markup from accidental change and modify only the text sections.



XML documents have a tree structure. The folding allows you to collapse elements leaving in the focus only the ones you need to edit. An unique feature of <oXygen/> is the fact that the folds are persistent: the next time you will open the document the folds are restored to the last state so you continue to work from where you left. For non XML files the folding strategy is to collapse blocks of text that have the same indent.

In the next image you can see that only one of the chapter sections is expanded and the rest are collapsed. The folds show in the right side the number of lines that were collapsed.

XML Folding

To make the fold operation faster you can use the contextual menu to collapse or expand all the child folds of an element.

Optional Content Generation

Optional content generation

When creating a new XML document the editor generates the content of the root element based on the required elements as it was specified in the associated schema or DTD. There are available two options to make the content generation process take into account also optional content and choice models thus allowing to obtain more content for the new document.

In the next figure the "site" element was chosen as the root of the new document. The checkboxes above the text show the settings from the "New document" dialog. You can see that activating the optional content generation options implies more generated content.

Generation of XML optional content