Content model

The Content model defines how TopLeaf processes the content of the element being mapped. There are four possible values:

  • Element — the element contains only child elements (that is, no character data). All white space (space, newline, tab etc) is ignored.

  • Mixed — the element may contain character data, optionally interspersed with child elements. All white space is honored but multiple whitespace characters are collapsed to a single space.

  • Preserve-Space — indicates that TopLeaf should attempt to preserve all the white space. All space characters (U+0020) are mapped to a fixed width space the width of a digit (U+0030 - U+0039) in the current font. A tab character (U+0009) is deemed equivalent to 4 fixed width spaces. Thus multiple spaces are wider than a single space, A non-breaking space (U+00A0) is equivalent to a normal space and a newline (U+000A) causes a line break in the output. White space characters of a specific size — for example, an en-space (U+2002) — are mapped as proportions of the current font width.

    In some circumstances, TopLeaf may be unable to honor the request to preserve all the white space. This can occur when the width of the assigned preserved space exceeds the available column width. If this occurs, TopLeaf will insert an emergency line break at what it considers to be the most suitable point within the line. The only way to assign an alternative line break point is to increase the available column width or reduce the current selected font size.

    This behavior is identical to that produced by xml:space="preserve" except that it is not inherited by child elements.

  • {default} — equivalent to Mixed, except if the element is defined in a DTD and

    • the content model defined by the element type declaration does not contain #PCDATA


    • if the element is defined as EMPTY

    then equivalent to Element;

For most mappings the {default} setting will suffice. However, an explicit setting may be required in the following circumstances:

  • when a document does not declare a document type declaration;

  • when you need to override the default setting;

  • when mapping a user-defined custom marker;

  • when you need to preserve spaces (for example, if a user customization for an EMPTY element emits mixed content)

[Note] Note

If a DTD defines an element to be EMPTY and that tag is mapped, any user customization emitted by that mapping is regarded as the content of the element. By default, any white space defined within that content will be ignored unless the mapping specifies an explicit content model.

The content model applied to the element being mapped is defined in the {content-model} system variable.