Schema Annotations in Author Mode
A schema annotation is a documentation snippet associated with the definition of an element or attribute in a schema. If such a schema is associated with an XML document, the annotations are displayed in the Content Completion Assistant.
Schema Annotation in the Content Completion Assistant
The schema annotations support is available if the schema type is one of the following:
- XML Schema
- Relax NG
- NVDL schema
- DTD
Styling Annotations with HTML
You can use HTML format in the annotations you add in an XML Schema or Relax NG schema.
This improves the visual appearance and readability of the documentation window displayed
when editing XML documents validated against such a schema. An annotation is recognized
and
displayed as HTML if it contains at least one HTML element (such as div
,
body
, p
, br
, table
,
ul
, or ol
).
The HTML rendering is controlled by the Show annotations using HTML format, if possible option in
the Annotations preferences page. When this options is disabled, the
annotations are converted and displayed as plain text and if the annotation contains
one or
more HTML tags (p
, br
, ul
,
li
), they are rendered as an HTML document loaded in a web browser. For
example, p
begins a new paragraph, br
breaks the current
line, ul
encloses a list of items, and li
encloses an item
of the list.
Collecting Annotations from XML Schemas
In an XML Schema, the annotations are specified in an <xs:annotation>
element like
this:
<xs:annotation> <xs:documentation> Description of the element. </xs:documentation> </xs:annotation>
If an element or attribute does not have a specific annotation, then Oxygen XML Author plugin looks for an annotation in the type definition of that element or attribute.
Collecting Annotations from Relax NG Schemas
For Relax NG schema, element and attribute annotations are made using the
<documentation>
element from the
http://relaxng.org/ns/compatibility/annotations/1.0
namespace. However,
any element outside the Relax NG namespace
(http://relaxng.org/ns/structure/1.0
) is handled as annotation and the
text content is displayed in the annotation window. To activate this behavior, enable
the
Use all Relax NG annotations as documentation option in
the Annotations preferences page.
Collecting Annotation from DTDs
For DTD, Oxygen XML Author plugin defines a custom mechanism for annotations using comments enabled from the Prefer DTD comments that start with "doc:" as annotations option in the Annotations preferences page. The following is an example of a DTD annotation:
<!--doc:Description of the element. -->