<fragment>

The <fragment> element contains a labeled subpart of the syntax within a syntax diagram.

Usage information

The <fragment> element enables breaking out logical chunks of a large syntax diagram into named fragments.

Specialization hierarchy

The <fragment> element is specialized from <figgroup>. It is defined in the syntax-diagram domain module, which is a specialization of the programming domain module.

Content model

<title> ?, ( <fragref> | <groupchoice> | <groupcomp> | <groupseq> | <synnote> | <synnoteref> )*

Attributes

The following attributes are available on this element: universal attributes.

The following attributes are available on this element: universal attributes.

Example

This section is non-normative.

The following code sample shows how the <fragment> element can be used to break out a set of related logging options from the larger set of syntax. This allows the logging options to be displayed separately in a titled group, out of the flow of the primary diagram.

<syntaxdiagram>
  <title>Syntax for runprogram command</title>
  <groupseq>
    <kwd>runprogram</kwd>
    <groupchoice>
      <groupcomp><oper>-</oper><kwd>i</kwd><sep>:</sep><var>program-name.py</var></groupcomp>
      <groupcomp><oper>--</oper><kwd>input</kwd><sep>=</sep><var>program-name.py</var></groupcomp>
    </groupchoice>
  </groupseq>
  <fragment>
    <title>Logging options</title>
    <groupseq importance="optional"><oper>--</oper><kwd>debug</kwd></groupseq>
    <groupseq importance="optional"><oper>--</oper><kwd>verbose</kwd></groupseq>
  </fragment>
</syntaxdiagram>