V5.2packagesynopsis

packagesynopsis — The syntax summary for a package definition.

Synopsis

packagesynopsis ::=

Attributes

Common attributes and common linking attributes.

Additional attributes:

  • language

Additional Constraints

  • If this element is the root element, it must have a version attribute.

Description

A packagesynopsis contains the syntax summary of a programming language “package”. In some languages (e.g., C#), what DocBook chooses to identify with the packagesynopsis tag is referred to as a namespace. This is to avoid confusion with the XML concept of “namespace”, and because other languages (e.g., Java) call these things packages.

Packages, in this sense, are generally wrappers (either explicitly or implicitly) for a collection of classes, methods, functions, etc.

Processing expectations

For the most part, the processing application is expected to generate all of the parentheses, semicolons, commas, and so on required in the rendered synopsis.

Attributes

Common attributes and common linking attributes.

language

Identifies the language (i.e. programming language) of the content.

Examples

A Java package containing a single class.

1<packagesynopsis xmlns="http://docbook.org/ns/docbook" version="5.0"
                language="java">
<package>org.example.packages</package>
<classsynopsis>
5<ooclass>
<modifier>public</modifier>
<classname>MyClass</classname>
</ooclass>
<fieldsynopsis>
10<modifier>public</modifier>
<modifier>static</modifier>
<modifier>final</modifier>
<type>int</type>
<varname>BASE</varname>
15<initializer>0</initializer>
</fieldsynopsis>
<constructorsynopsis>
<modifier>public</modifier>
<methodname>MyClass</methodname>
20<void/>
</constructorsynopsis>
<methodsynopsis>
<modifier>public</modifier>
<void/>
25<methodname>dwim</methodname>
<methodparam>
<type>int</type>
<parameter>scope</parameter>
</methodparam>
30</methodsynopsis>
</classsynopsis>
 
</packagesynopsis>
package org.example.packages;
public class MyClass {
  public static final int BASE = 0;
  public MyClass();
  public dwim(int scope);
}