Customizing the Rendering of Elements
In addition to the support for configuring the proposals that appear in the Content Completion Assistant, Oxygen XML Editor also includes support for customizing how the elements are rendered. You can do this by using the XMLNodeRendererCustomizer API extension, but you can also use the same configuration file that is used to configure the content completion proposals.
For an example of a specific use-case, suppose that in DITA you want the names of paragraph
elements (p) to be rendered as "Paragraph" instead of "p" in
the various components in Author mode (such as in the
Outline view, Elements view,
Attributes view, and the breadcrumb navigation bar). To achieve this,
you can use the elementRenderings element in the configuration file.
Setting up the Content Completion Configuration File
Changing the Rendering of Elements (Their Names, Annotations, and Icons)
For the purposes of customizing how the content completion elements are rendered, you can
use the render element inside a elementRenderings element
to specify how element names, their annotations, and their icons are rendered.
render element also accepts the following element to change
the tooltip annotations for an element (in both Author mode and
Text mode):annotation- This element can be used within therenderelement to customize the tooltip annotations that are displayed for the element in various components in Author mode (such as tooltips shown in the Content Completion Assistant documentation window, the breadcrumb navigation bar, the Full Tags display mode, and the Outline, Elements, and Attributes views), as well as the tooltips that are displayed when you hover over elements in Text mode. You can use HTML content to style the annotations (see the example below).Note: If this element is missing, the styling for the annotations for that element is collected from the associated schema.
Other Important Notes About the Configuration File for Rendering Elements
- This configuration file only affects the content completion assistance, not validation.
- To test the effects of your changes, you should restart the application, although in
some cases, you can simply use the
Refresh (F5) action to test your
customizations. - If the framework has an associated styleguide, then the annotations defined in the configuration file will take precedence over those defined in the styleguide. To check to see if your framework uses a styleguide, look for the following folder: ${oXygenInstallDir}frameworks/${framework}/styleguide/. If that folder exists, it is recommended that you make your annotation changes directly in the styleguide, rather than in the configuration file.
- If an XMLNodeRendererCustomizer API extension has been implemented for the framework and a configuration file is also used, the rendering customization for an element will be the result of merging the two. For example, if the XMLNodeRendererCustomizer implementation customizes the element name, while the configuration file specifies an icon for the element, the properties of both customizations will be rendered. However, if both implementations define the same property (for example, both specify the rendering of an element name), the customizations defined in the configuration file take precedence.
- The rendering customizations defined in the configuration file also applies to aspects of the Oxygen XML WebApp Component interface.
Example: Changing the Rendering of an Element
title element to
begin with a capital letter, use a custom icon for it, and provide specific documentation
for that element in the various components in Author mode. The
configuration file should look like
this:<elementRenderings> <render element="title" as="Title" iconPath="cimg/AcceptAll16.png"> <annotation> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Documentation for the Title Element</title> </head> <body> <p>A <i>heading</i> or <b>label</b> for the main parts of a topic</p> </body> </html> </annotation> </render> </elementRenderings>
Refresh (