Guide to the DocBook DTD
PrevNext

Example

Name

Example — Example of a computer program or related information

Content Model

  ((Title, TitleAbbrev?), (CalloutList | GlossList
  | ItemizedList | OrderedList | SegmentedList | SimpleList
  | VariableList | LiteralLayout | ProgramListing
  | ProgramListingCO | Screen | ScreenCO | ScreenShot
  | Synopsis | CmdSynopsis | FuncSynopsis | FormalPara | Para
  | SimPara | Address | BlockQuote | Graphic | GraphicCO
  | InformalEquation | InformalExample
  | InformalTable)+)
  -(Equation | Example | Figure | Table)

Exclusions

Example excludes these elements at every level:

  Equation | Example | Figure | Table

Attributes

This element has common and Role attributes.

NameValue(s)TypeDefault Value
LabelCDATA#IMPLIED 
WidthNUMBER#IMPLIED 

Tag Minimization

Both the start- and end-tags are required for this element.

Description

Example of a computer program or related information, typically a section of program source code. It contains a required Title and an optional TitleAbbrev, followed by one or more block-oriented elements in any combination. A simple Example might contain a Title and a ProgramListing. It has Label, Width, and common attributes.

Parents

These elements contain Example: Appendix, Article, BiblioDiv, Bibliography, BlockQuote, Callout, Caution, Chapter, GlossDef, GlossDiv, Glossary, Important, Index, ListItem, MsgExplan, MsgText, Note, Para, PartIntro, Preface, Procedure, RefSect1, RefSect2, RefSect3, RefSynopsisDiv, Sect1, Sect2, Sect3, Sect4, Sect5, SetIndex, Sidebar, SimpleSect, Step, Tip, Warning.

Children

Example contains these elements: Address, BlockQuote, CalloutList, CmdSynopsis, FormalPara, FuncSynopsis, GlossList, Graphic, GraphicCO, InformalEquation, InformalExample, InformalTable, ItemizedList, LiteralLayout, OrderedList, Para, ProgramListing, ProgramListingCO, Screen, ScreenCO, ScreenShot, SegmentedList, SimPara, SimpleList, Synopsis, Title, TitleAbbrev, VariableList.

In some contexts, additional elements may be allowed by inclusions in parent elements. Similarly, in some contexts, some of these elements may be invalid due to exclusions in parent elements.

Attributes

Label

Label holds an identifying number or string to be output in some manner when the element it is applied to is rendered.

Width

Width indicates the width of the longest line in the element to which it pertains, in number of characters.

Examples

<EXAMPLE ID="EX-1002-5-4">
<TITLE>Example of switching graphics contexts
</TITLE>
<PROGRAMLISTING>GC gc1, gc2;
XGCValues values;<LINEANNOTATION>Note capitalization</LINEANNOTATION>
unsigned long valuemask;
        .
        .
        .
/* Open display, create window, etc. */
values.foreground = BlackPixel(display,screen_num);
values.background = WhitePixel(display,screen_num);
gc1 = XCreateGC(display, RootWindow(display, screen_num),
        (GCForeground | GCBackground), &amp;values);
values.foreground = WhitePixel(display,screen_num);
values.background = BlackPixel(display,screen_num);
gc2 = XCreateGC(display, RootWindow(display, screen_num),
        (GCForeground | GCBackground), &amp;values);
/* Now you can use either gc in drawing routines, thereby
 * quickly swapping the foreground and background colors */
</PROGRAMLISTING>
</EXAMPLE>

PrevHomeNext
ErrorTypeUpFax