Proposing Attribute Values from an External Database
In some cases, the value of an attribute is a reference to an external database (for example, a citation, a product number, etc.) In these cases, Oxygen XML Web Author can be configured to propose only values for that attribute that are valid regarding the content of the external database (for example, valid product numbers, valid references to articles, etc.)
The value of the attribute can be set either by using the attributes panel or an inline form-control such as a combo-box. By default, the options presented in the combo-box form control are the same as the ones provided by the attributes panel and they are the valid attribute values defined in the schema attached to the XML document.
There are several ways to implement this:
- Use a cc_config.xml configuration file for your custom framework to configure the values that are proposed for an attribute in the Attributes side-view.
- Use the JavaScript sync.actions.AttributeEditingActionsProvider API to implement a widget that will be presented in the Attributes side-view to allow the user to choose a value for an attribute.
- Customize Oxygen XML Web Author to propose custom values for an attribute by using the SchemaManagerFilter Java API. This is a server-side implementation and has the possibility to cache the values between multiple documents.
- For DITA documents, if a Subject Scheme map is referenced in the root DITA map, it will be used when proposing values for an attribute. If having a static map with possible attribute values is not flexible enough, you can use the ro.sync.exml.workspace.api.editor.page.ditamap.keys.KeyDefinitionManager API class. It has a getEnumerationDefinitions method that can be used to return possible values for an attribute.
- Implement a custom form
control that connects to the external database to propose choices to the user. In
this form control, you can fetch the options on-demand, which may be useful for large
databases. An example of a custom form control is available on GitHub.Warning: Your external database needs to have an HTTP API with CORS enabled to be able to query it from Oxygen XML Web Author.