Available datatypes for XML contents
When creating XML contents, different data types can be used according to the requirements of the desired content. To each data type, a default widget is mapped which creates the input element (e.g. a text input field) for the form based XML content editor.
OpenCms provides the following data types for XML contents:
Data type | Description | Default widget |
OpenCmsBoolean | Used to store a boolean value like true or false. If not set, the default value returned is false. | BooleanWidget |
OpenCmsColor | Used to store a color value in the hexadecimal HTML format #RRGGBB . | ColorpickerWidget |
OpenCmsDateTime | Used to store a date/time information. | DateTimeWidget |
OpenCmsHtml | Fields of this type provide the possibility to store text including HTML markup code formatting. | HtmlWidget |
OpenCmsLocale | Stores Locale information, possible values are e.g. "en" or "de". | StringWidget |
OpenCmsString | Stores short Strings which need no HTML formatting. | StringWidget |
OpenCmsVfsFile | Stores links to other files in the VFS of OpenCms as absolute paths. | VfsFileWidget |
For each of the above described data types, a default widget is mapped. There are several other widgets available for usage in the XML content editor.
Editor widgets for the different data types
Data type | Description |
BooleanWidget | Generates a check box input element to change the value of a boolean data type. |
ColorpickerWidget | Provides a text input field for manual input and a color picker popup to select the color with the mouse. |
ComboWidget | Provides a combo widget looking like a select box with the possibility to enter a value instead of selecting an option. |
DateTimeWidget | Provides a text input field and an option to open a JavaScript calendar to select the date and/or time more comfortable. |
DisplayWidget | Provides a display only widget. |
DownloadGalleryWidget | Provides a text input field and the possibility to open a download gallery for direct selection of the desired download file. |
HtmlGalleryWidget | Provides a preview frame and the option to select a HTML snippet from a HTML gallery. |
HtmlWidget | Shows a WYSIWYG text area with formatting options to create formatted texts. |
ImageGalleryWidget | Images from an OpenCms image gallery can be selected when using this widget. A preview option is also given after an image was chosen. |
LinkGalleryWidget | Links from the external links galleries can be selected with the LinkGalleryWidget. |
MultiSelectWidget | Provides a widget for a standard HTML form multi select list. |
SelectorWidget | Provides a select box for choosing one out of a given range of options. A description how to configure a select box widget is given later in this documentation. |
StringWidget | A simple text input field is generated when using the StringWidget. |
StringWidgetPlaintext | Provides a simple text input field that strips HTML Tags from the input before storing the value. |
TableGalleryWidget | Tables from an OpenCms table gallery can be selected. The table HTML is pasted in the content field. |
TextareaWidget | Provides a textarea with 4 lines for longer unformatted text inputs. |
TextareaWidgetPlaintext | Provides a textarea for longer unformatted text inputs that strips HTML Tags from the input before storing the value. |
VfsFileWidget | A text input field with the option to open a file selector popup window to select a file from the OpenCms VFS is generated. |
For a demonstration of the different editor widgets, have a look at the widgetdemo file /xmlcontent/widgetdemo/widgetdemo_0001.html and edit it (only available if the module org.opencms.frontend.templateone.xmlcontentdemo is installed).
Learn in the next step about advanced configuration options of XML contents by using the appinfo node in XSDs.