]> git.evergreen-ils.org Git - Evergreen.git/blob - docs/1.6/programming.xml
Adding first of a series of files to the styleguide section.
[Evergreen.git] / docs / 1.6 / programming.xml
1 <?xml version='1.0' encoding='UTF-8'?>\r
2 <chapter xmlns="http://docbook.org/ns/docbook"\r
3 xmlns:xi="http://www.w3.org/2001/XInclude"\r
4 xmlns:xl="http://www.w3.org/1999/xlink"\r
5 version="5.0"\r
6 xml:id="programming">\r
7   <title>Working with Code</title>\r
8   <info>\r
9     <abstract>\r
10       <para>There are several instances when you will need to show code in documentation. You may need to use a class name, an interface name, \r
11         or an element name as part of a sentence. You will also need to provide long code samples in many places. DocBook has a number of \r
12         elements that are used for placing code in your documentation.</para>\r
13     </abstract>\r
14   </info>\r
15   <section>\r
16     <title>Code Listings</title>\r
17     <para>There are two types of code listings:</para>\r
18     <itemizedlist>\r
19       <listitem linkend="exampleSect">\r
20         <para>Formal examples with titles</para>\r
21       </listitem>\r
22       <listitem linkend="codeBlockSect">\r
23         <para>Untitled code blocks</para>\r
24       </listitem>\r
25     </itemizedlist>\r
26     <para>Often when making long code listings a writer also needs to explain what specific lines of code do. This can be done using \r
27     callouts as explained in <xref linkend="calloutSect" /></para>\r
28     <section xml:id="exampleSect">\r
29       <title>Examples</title>\r
30       <simplesect>\r
31         <title>When to use</title>\r
32         <para>Examples are formal code listings that have a title. They are useful for code listings that are linked to from other places in \r
33           the text. They are also added to the <emphasis>List of Examples</emphasis>.</para>\r
34       </simplesect>\r
35       <simplesect>\r
36         <title>Marking up an example</title>\r
37         <indexterm><primary>example element</primary></indexterm>\r
38         <indexterm><primary>programlisting element</primary></indexterm>\r
39         <para>Examples are marked up using the <tag class="element">example</tag> element. You should always provide a descriptive value for \r
40           the <tag class="element">example</tag> element's <tag class="attribute">xml:id</tag> attribute. The \r
41         <tag class="element">example</tag> element also takes a <tag class="attribute">pgwide</tag> attribute that signals that the \r
42         code listing should span the width of the page.<footnote><para>The <tag class="attribute">pgwide</tag> attribute is not currently \r
43         supported by the publication system. Writers will also need the PI for making code blocks wide as shown in \r
44           <xref linkend="examplePgwideSS" />.</para></footnote></para>\r
45         <para>The first child of the <tag class="element">example</tag> element is a <tag class="element">title</tag> element. The contents of \r
46         the title element will be used as the caption of the example. It will also be used as the text for any cross references.</para>\r
47         <para>The last child of the example element is the <tag class="element">programlisting</tag> element. The \r
48         <tag class="element">programlisting</tag> element contains the code sample itself. Any text placed inside the \r
49         <tag class="element">programlisting</tag> element is treated literally. Therefore, any spacing that you use will be exactly reproduced \r
50         when the document is produced.</para>\r
51       <warning>\r
52         <para>When using XML inside a <tag class="element">programlisting</tag> element you must not use the <literal>&lt;</literal> or \r
53           <literal>&gt;</literal> characters. Instead use <wordasword>&amp;lt;</wordasword> and <wordasword>&amp;gt;</wordasword>.</para>\r
54       </warning>\r
55         <para>The <tag class="element">programlisting</tag> element takes a <tag class="attribute">language</tag> attribute that \r
56         specifies the type of code in the example. <xref linkend="languageAttrTbl"/> describes the acceptable values.</para>\r
57         <table xml:id="languageAttrTbl">\r
58           <title>Values for the Program Listing Language Attribute</title>\r
59           <tgroup cols="2">\r
60             <thead>\r
61               <row>\r
62                 <entry>Value</entry>\r
63                 <entry>Description</entry>\r
64               </row>\r
65             </thead>\r
66             <tbody>\r
67               <row>\r
68                 <entry><tag class="attvalue">java</tag></entry>\r
69                 <entry>Specifies that the listing is Java code.</entry>\r
70               </row>\r
71               <row>\r
72                 <entry><tag class="attvalue">spring</tag></entry>\r
73                 <entry>Specifies that the listing is Spring XML. This is often used in configuration files.</entry>\r
74               </row>\r
75               <row>\r
76                 <entry><tag class="attvalue">wsdl</tag></entry>\r
77                 <entry>Specifies that the listing is WSDL.</entry>\r
78               </row>\r
79               <row>\r
80                 <entry><tag class="attvalue">xmlschema</tag></entry>\r
81                 <entry>Specifies that the code listing is XML Schema. This is often seen in the type's section of a WSDL document.</entry>\r
82               </row>\r
83               <row>\r
84                 <entry><tag class="attvalue">xml</tag></entry>\r
85                 <entry>Specifies that the code listing is XML.</entry>\r
86               </row>\r
87             </tbody>\r
88           </tgroup>\r
89         </table>\r
90       </simplesect>\r
91       <simplesect>\r
92         <title>Example</title>\r
93         <para><xref linkend="example_example"/> shows the mark-up for an example.</para>\r
94         <example xml:id="example_example" pgwide="1">\r
95         <?dbfo pgwide="1"?>\r
96         <title>Example Mark-Up</title>\r
97         <programlisting>&lt;example id=&quot;example_example&quot;&gt;\r
98 &lt;title&gt;Example Service&lt;/title&gt;\r
99 &lt;programlisting language="java"&gt;public class ServiceName extends javax.xml.ws.Service\r
100 {\r
101   ...\r
102   public ServiceName(URL wsdlLocation, QName serviceName) { }\r
103   \r
104   public ServiceName() { }\r
105 \r
106   public Greeter getPortName() { }\r
107   .\r
108   .\r
109   .\r
110 }&lt;/programlisting&gt;\r
111 &lt;/example&gt;</programlisting>\r
112         </example>\r
113         <para>The mark-up shown in <xref linkend="example_example" /> is generated into <xref linkend="exampleExampleGen" />.</para>\r
114         <example xml:id="exampleExampleGen">\r
115           <title>Example Service</title>\r
116           <programlisting language="java">public class ServiceName extends javax.xml.ws.Service\r
117 {\r
118   ...\r
119   public ServiceName(URL wsdlLocation, QName serviceName) { }\r
120   \r
121   public ServiceName() { }\r
122 \r
123   public Greeter getPortName() { }\r
124   .\r
125   .\r
126   .\r
127 }</programlisting>\r
128         </example>\r
129       </simplesect>\r
130       <simplesect xml:id="examplePgwideSS">\r
131         <title>Making the example span the page</title>\r
132         <para>The code used for an example does not always fit properly in the space allotted for text in the PDF output template. To fix this \r
133         writers can specify that an example should span the entire page from the left margin to the right margin using the \r
134           <markup>&lt;?dbfo pgwide="1"?&gt;</markup> PI.</para>\r
135         <para>As shown in <xref linkend="examplePgwideEx"/>, the <markup>&lt;?dbfo pgwide="1"?&gt;</markup> PI is placed directly \r
136         after the opening <tag class="element">example</tag> tag.</para>\r
137         <example xml:id="examplePgwideEx">\r
138         <?dbfo pgwide="1"?>\r
139         <title>Wide Example Mark-Up</title>\r
140         <programlisting>&lt;example id="examplePgwideEx"&gt;\r
141 &lt;?dbfo pgwide="1"?&gt;\r
142 &lt;title&gt;Example Service&lt;/title&gt;\r
143 &lt;programlisting language="java"&gt;\r
144   .\r
145   .\r
146   .\r
147 }&lt;/programlisting&gt;\r
148 &lt;/example&gt;</programlisting>\r
149         </example>\r
150       </simplesect>\r
151       </section>\r
152     <section xml:id="codeBlockSect">\r
153       <title>Code Blocks</title>\r
154       <simplesect>\r
155         <title>When to use</title>\r
156         <para>Code blocks are useful for short code listings that show a specific action. They are not appropriate for code listings \r
157         that need to be referenced later. They also do not appear in the <emphasis>List of Examples</emphasis>.</para>\r
158       </simplesect>\r
159       <simplesect>\r
160         <title>Mark-up</title>\r
161         <indexterm><primary>informalexample element</primary></indexterm>\r
162         <indexterm><primary>programlisting element</primary></indexterm>\r
163          <para>Code blocks are marked up using the <tag class="element">informalexample</tag> element.</para>\r
164         <para>The only child of the <tag class="element">informalexample</tag> element is a <tag class="element">programlisting</tag> element. \r
165           This element contains the code listing itself. Any text placed inside the <tag class="element">programlisting</tag> element is \r
166           treated literally. Therefore, any spacing that you use will be exactly reproduced when the document is produced.</para>\r
167         <warning>\r
168           <para>When using XML inside a <tag class="element">programlisting</tag> element you must not use the <literal>&lt;</literal> or \r
169           <literal>&gt;</literal> characters. Instead use <wordasword>&amp;lt;</wordasword> and <wordasword>&amp;gt;</wordasword>.</para>\r
170         </warning>\r
171         <para>The <tag class="element">programlisting</tag> element takes a <tag class="attribute">language</tag> attribute that \r
172         specifies the type of code in the example. <xref linkend="languageAttrTbl"/> describes the acceptable values.</para>\r
173       </simplesect>\r
174       <simplesect>\r
175         <title>Example</title>\r
176         <para><xref linkend="block_example"/> shows the mark-up for a standalone block of code.</para>\r
177         <example xml:id="block_example" pgwide="1">\r
178         <?dbfo pgwide="1"?>\r
179         <title>Example Code Block</title>\r
180         <programlisting>&lt;informalexample&gt;\r
181   &lt;programlisting language="javascript"&gt;var WebServiceProvider1 = {\r
182     &apos;wsdlLocation&apos;: &apos;file:./wsdl/hello_world.wsdl&apos;,\r
183     &apos;serviceName&apos;: &apos;SOAPService1&apos;,\r
184     &apos;portName&apos;: &apos;SoapPort1&apos;,\r
185     &apos;targetNamespace&apos;: http://objectweb.org/hello_world_soap_http&apos;,\r
186 };&lt;/programlisting&gt;\r
187 &lt;/informalexample&gt;</programlisting>\r
188           </example>\r
189           <para>The mark-up shown in <xref linkend="block_example"/> would be published as follows:</para>\r
190           <informalexample>\r
191   <programlisting language="javascript">var WebServiceProvider1 = {\r
192     'wsdlLocation': 'file:./wsdl/hello_world.wsdl',\r
193     'serviceName': 'SOAPService1',\r
194     'portName': 'SoapPort1',\r
195     'targetNamespace': 'http://objectweb.org/hello_world_soap_http',\r
196 };</programlisting>\r
197 </informalexample>\r
198       </simplesect>\r
199       <simplesect xml:id="codeBlockPgwideSS">\r
200         <title>Making the code block span the page</title>\r
201         <para>Code listings do not always fit properly in the space allotted for text in the PDF output template. To fix this \r
202         writers can specify that a code listing should span the entire page from the left margin to the right margin using the \r
203           <markup>&lt;?dbfo pgwide="1"?&gt;</markup> PI.</para>\r
204         <para>As shown in <xref linkend="codeBlockPgwideEx"/>, the <markup>&lt;?dbfo pgwide="1"?&gt;</markup> PI is placed directly \r
205         after the opening <tag class="element">informalexample</tag> tag.</para>\r
206         <example xml:id="codeBlockPgwideEx">\r
207         <?dbfo pgwide="1"?>\r
208         <title>Wide Code Block Mark-Up</title>\r
209         <programlisting>&lt;informalexample id="codeBlockPgwideEx"&gt;\r
210 &lt;?dbfo pgwide="1"?&gt;\r
211 &lt;programlisting language="java"&gt;\r
212   .\r
213   .\r
214   .\r
215 }&lt;/programlisting&gt;\r
216 &lt;/informalexample&gt;</programlisting>\r
217         </example>\r
218       </simplesect>\r
219       </section>\r
220       <section xml:id="calloutSect">\r
221         <title>Using Callouts</title>\r
222         <indexterm><primary>co element</primary></indexterm>\r
223         <indexterm><primary>calloutlist element</primary></indexterm>\r
224         <para>It is often helpful to use callouts to explain what it happening in a section of code. Specifying callouts is a two step process:</para>\r
225         <orderedlist>\r
226           <listitem>\r
227             <para>Specify where in the code listing you want to place callout markers.</para>\r
228           </listitem>\r
229           <listitem>\r
230             <para>Specify the callout text for each callout.</para>\r
231           </listitem>\r
232         </orderedlist>\r
233         <simplesect>\r
234           <title>Specifying the callout locations</title>\r
235           <para>To specify the placement of a callout in a program listing you place a <tag class="element">co</tag> element at the location inside of the program listing you want the callout to appear. The <tag class="element">co</tag> element requires that you set a value for its <tag class="attribute">id</tag> attribute. The value is used to associate the callout marker with the text that describes it. You should also provide a value for the <tag class="element">co</tag> element's <tag class="attribute">linkends</tag> attribute. This value will match the value of the <tag class="attribute">id</tag> attribute of the associated text. Using this attribute allows for a links to be generated between the callout and the associated text.</para>\r
236           <note>\r
237             <para>Setting the <tag class="attribute">linkends</tag> attribute before entering the callout text will result in an invalid XML file. Once you add the callout text, the file should be valid.</para>\r
238           </note>\r
239         </simplesect>\r
240         <simplesect>\r
241           <title>Specifying the callout text</title>\r
242           <para>The text associated with a callout is specified outside of the <tag class="element">programlisting</tag> element and the <tag class="element">example</tag> element. Shortly after the <tag class="element">example</tag> element, preferably immediately after, you need to place a <tag class="element">calloutlist</tag> element. The <tag class="element">calloutlist</tag> element wraps the elements that specify the callout text. It contains an optional <tag class="element">title</tag> element and one <tag class="element">callout</tag> element for each callout specified for the associated program listing.</para>\r
243           <para>Each <tag class="element">callout</tag> element must have its <tag class="attribute">arearefs</tag> attribute set to the value of <tag class="attribute">id</tag> attribute of the callout for which it defines the text. If you set the <tag class="attribute">linkends</tag> attribute of the associated <tag class="element">co</tag> element, you must also set the <tag class="element">callout</tag> element&apos;s <tag class="attribute">id</tag> attribute to the matching value. The callout text is the value of the <tag class="element">callout</tag> element.</para>\r
244         </simplesect>\r
245         <simplesect>\r
246           <title>Example</title>\r
247           <para><xref linkend="callout_example"/> shows the mark-up for  <olink targetptr="LinksCalloutExample"/>.</para>\r
248           <example xml:id="callout_example" pgwide="1">\r
249             <?dbfo pgwide="1"?>\r
250               <title>Using Callouts</title>\r
251               <programlisting>&lt;example xml:id="LinksCalloutExample"&gt;\r
252 &lt;dbfo pgwide="1"?&gt;\r
253   &lt;title&gt;Document Set Site Map&lt;/title&gt;\r
254   &lt;programlisting&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;co linkends="sitemapptr0" xml:id="sitemapco0"/&gt;\r
255 &lt;targetset&gt; &lt;co linkends="sitemapptr3" xml:id="sitemapco3"/&gt;\r
256   &lt;targetsetinfo&gt; &lt;co linkends="sitemapptr4" xml:id="sitemapco4"/&gt;\r
257     Site map for the Evergreen XML Style Guide\r
258   &lt;/targetsetinfo&gt;\r
259   &lt;sitemap&gt; &lt;co linkends="sitemapptr5" xml:id="sitemapco5"/&gt;\r
260     &lt;dir name=&quot;docs_rls_inferno&quot;&gt; &lt;co linkends="sitemapptr6" xml:id="sitemapco6"/>\r
261       &lt;dir name=&quot;fluff&quot;&gt; &lt;co linkends="sitemapptr75" xml:id="sitemapco75"/>\r
262         &lt;dir name=&quot;overview&quot;&gt; &lt;co linkends="sitemapptr7" xml:id="sitemapco7"/>\r
263           &lt;document targetdoc=&quot;InfernoOverview&quot;&gt; &lt;co linkends="sitemapptr8" xml:id="sitemapco8"/>\r
264            &lt;xi:include href="overview/target.db" xmlns:xi="http://www.w3.org/2001/XInclude" /&gt; &lt;co linkends="sitemapptr9" xml:id="sitemapco9"/>\r
265           &lt;/document&gt;\r
266         &lt;/dir&gt;\r
267       &lt;/dir&gt;\r
268       &lt;dir name=&quot;install_guide&quot;&gt;\r
269         &lt;document targetdoc=&quot;InfernoInstall&quot;&gt;\r
270         &lt;xi:include href="install_guide/target.db" xmlns:xi="http://www.w3.org/2001/XInclude" /&gt;\r
271         &lt;/document&gt;\r
272       &lt;/dir&gt;\r
273       &lt;dir name=&quot;getting_started&quot;&gt;\r
274         &lt;document targetdoc=&quot;InfernoGetStarted&quot;&gt;\r
275         &lt;xi:include href="get_started/target.db" xmlns:xi="http://www.w3.org/2001/XInclude" /&gt;\r
276         &lt;/document&gt;\r
277       &lt;/dir&gt;\r
278     &lt;/dir&gt;\r
279   &lt;/sitemap&gt;\r
280 &lt;/targetset&gt;&lt;/programlisting&gt;\r
281 &lt;/example&gt;\r
282 &lt;calloutlist&gt;\r
283   &lt;title>Elements of the Site Map&lt;/title>\r
284   &lt;callout arearefs="sitemapco0" xml:id="sitemapptr0"&gt;\r
285     &lt;para>The site map should always be encoded as UTF-8. This ensures that all of the generated target data has the same encodings regardless of the encodings used by the XML source files.&lt;/para>\r
286   &lt;/callout>\r
287   &lt;callout arearefs="sitemapco3" xml:id="sitemapptr3">\r
288     &lt;para>The &lt;tag class="element">targetset&lt;/tag> element is the root of the site map.&lt;/para>\r
289   &lt;/callout&gt;\r
290   &lt;callout arearefs="sitemapco4" xml:id="sitemapptr4"&gt;\r
291     &lt;para&gt;The &lt;tag class="element"&gt;targetsetinfo&lt;/tag&gt; element allows you to provide a description for the document set or any other information that is relevant to the site map.&lt;/para&gt;\r
292   &lt;/callout&gt;\r
293   &lt;callout arearefs="sitemapco5" xml:id="sitemapptr5"&gt;\r
294     &lt;para&gt;The &lt;tag class="element">sitemap&lt;/tag> element contains the directory layout of the output files.&lt;/para&gt;\r
295   &lt;/callout&gt;\r
296   &lt;callout arearefs="sitemapco6" xml:id="sitemapptr6"&gt;\r
297     &lt;para&gt;The name of the top-level directory is not important in the generation of the target databases for the links. The links are generated relative to the top-level directory.&lt;/para&gt;\r
298   &lt;/callout&gt;\r
299   &lt;callout arearefs="sitemapco75" xml:id="sitemapptr75"&gt;\r
300     &lt;para&gt;This is a directory that only contains other directories.&lt;/para&gt;\r
301   &lt;/callout&gt;\r
302   &lt;callout arearefs="sitemapco7" xml:id="sitemapptr7"&gt;\r
303     &lt;para&gt;This directory holds a generated book.&lt;/para&gt;\r
304   &lt;/callout&gt;\r
305   &lt;callout arearefs="sitemapco8" xml:id="sitemapptr8"&gt;\r
306     &lt;para&gt;The &lt;tag class="element">document&lt;/tag> element&apos;s &lt;tag class="attribute">targetdoc&lt;/tag> attribute specifies the identifier used in the &lt;tag class="element">olink&lt;/tag> element's &lt;tag class="attribute">targetdoc&lt;/tag> attribute when linking to targets in the document.&lt;/para&gt;\r
307   &lt;/callout&gt;\r
308   &lt;callout arearefs="sitemapco9" xml:id="sitemapptr9"&gt;\r
309     &lt;para&gt;The target database is included in the site map using an &lt;tag class="element"&gt;xi:include&lt;/tag&gt; element. The path for each book's target database should be &lt;filename>&lt;replaceable>book_src_dir&lt;/replaceable>/target.db&lt;/filename&gt;.&lt;/para&gt;\r
310   &lt;/callout&gt;\r
311 &lt;/calloutlist&gt;</programlisting>\r
312             </example>\r
313         </simplesect>\r
314       </section>\r
315   </section>\r
316   <section xml:id="prog_arts">\r
317     <title>In-line Code</title>\r
318     <simplesect>\r
319       <title>DocBook programming elements</title>\r
320       <para>There are many instances where you need to place a code artifact in a block of text such as when you are referring to a Java class \r
321         or an XML element. DocBook has a number of specialized elements for placing code artifacts in-line. The ones commonly used \r
322         include:</para>\r
323     <itemizedlist>\r
324       <listitem>\r
325         <para><tag class="element">tag</tag></para>\r
326       </listitem>\r
327       <listitem>\r
328         <para><tag class="element">classname</tag></para>\r
329       </listitem>\r
330       <listitem>\r
331         <para><tag class="element">interfacename</tag></para>\r
332       </listitem>\r
333       <listitem>\r
334         <para><tag class="element">methodname</tag></para>\r
335       </listitem>\r
336       <listitem>\r
337         <para><tag class="element">uri</tag></para>\r
338       </listitem>\r
339       <listitem>\r
340         <para><tag class="element">package</tag></para>\r
341       </listitem>\r
342       <listitem>\r
343         <para><tag class="element">code</tag></para>\r
344       </listitem>\r
345     </itemizedlist>\r
346     </simplesect>\r
347     <simplesect>\r
348       <title>XML artifacts</title>\r
349       <para>When placing XML artifacts such as element names or attribute names in your text wrap them in an \r
350         <tag class="element">tag</tag> element. To specify the type of XML artifact, the <tag class="element">tag</tag> element's \r
351         <tag class="attribute">class</tag> attribute is always used. <xref linkend="class_values"/> shows the values used for the \r
352         <tag class="attribute">class</tag> attribute.</para>\r
353       <table xml:id="class_values">\r
354         <title>Values for the <tag class="attribute">class</tag> Attribute</title>\r
355         <tgroup cols="2">\r
356           <colspec colwidth="1.5in"/>\r
357           <thead>\r
358             <row>\r
359               <entry>Value</entry>\r
360               <entry>Description</entry>\r
361             </row>\r
362           </thead>\r
363           <tbody>\r
364             <row>\r
365               <entry><tag class="attvalue">attribute</tag></entry>\r
366               <entry>Specifies that the artifact is an attribute of an XML element.</entry>\r
367             </row>\r
368             <row>\r
369               <entry><tag class="attvalue">element</tag></entry>\r
370               <entry>Specifies that the artifact is an XML element.</entry>\r
371             </row>\r
372             <row>\r
373               <entry><tag class="attvalue">attvalue</tag></entry>\r
374               <entry>Specifies that the artifact is the value of an XML element's attribute.</entry>\r
375             </row>\r
376             <row>\r
377               <entry><tag class="attvalue">emptytag</tag></entry>\r
378               <entry>Specifies an XML element that does not hold any data such as <tag class="emptytag">foo</tag>.</entry>\r
379             </row>\r
380           </tbody>\r
381         </tgroup>\r
382       </table>\r
383     </simplesect>\r
384     <simplesect>\r
385       <title>Web Addresses, URIs, and E-Mail Addresses</title>\r
386       <para>To specify a Web address or URI you use the <tag class="element">uri</tag> element.</para>\r
387       <para>To specify an E-Mail address use the <tag class="element">email</tag> element.</para>\r
388     </simplesect>\r
389     <simplesect xml:id="gen_prog_arts">\r
390       <title>General programming language artifacts</title>\r
391       <para>DocBook defines a number of in-line tags for specifying programming artifacts. The commonly used tags are listed in \r
392         <xref linkend="progarti"/>.</para>\r
393       <table frame="all" xml:id="progarti">\r
394         <title>Elements for In-Line Programming Artifacts</title>\r
395         <tgroup cols="2">\r
396           <colspec colnum="1" colname="c1" colwidth="1.5in"/>\r
397           <colspec colnum="2" colname="c2"/>\r
398           <thead>\r
399             <row>\r
400               <entry>Element</entry>\r
401               <entry>Description</entry>\r
402             </row>\r
403           </thead>\r
404           <tbody>\r
405             <row>\r
406               <entry><tag class="element">type</tag></entry>\r
407               <entry>Specifies that the artifact is a data type such as <type>int</type>.</entry>\r
408             </row>\r
409             <row>\r
410               <entry><tag class="element">constant</tag></entry>\r
411               <entry>Specifies that the artifact is a constant such as <constant>NULL</constant> or <constant>9</constant>.</entry>\r
412             </row>\r
413             <row>\r
414               <entry><tag class="element">exceptionname</tag></entry>\r
415               <entry>Specifies that the artifact is an exception. It could be the name of the exception or the name of the class that \r
416                 implements the exception.</entry>\r
417             </row>\r
418             <row>\r
419               <entry><tag class="element">function</tag></entry>\r
420               <entry>Specifies that the artifact is a function such as <function>println()</function>.</entry>\r
421             </row>\r
422             <row>\r
423               <entry><tag class="element">parameter</tag></entry>\r
424               <entry>Specifies that the artifact is a parameter to a function or a method.</entry>\r
425             </row>\r
426             <row>\r
427               <entry><tag class="element">varname</tag></entry>\r
428               <entry>Specifies that the artifact is a variable.</entry>\r
429             </row>\r
430             <row>\r
431               <entry><tag class="element">code</tag></entry>\r
432               <entry>Used for generic code entries that do not fit into any other category.</entry>\r
433             </row>\r
434             <row>\r
435               <entry><markup>code role="annotation"</markup></entry>\r
436               <entry>Used for Java annotations.</entry>\r
437             </row>\r
438           </tbody>\r
439         </tgroup>\r
440       </table>\r
441     </simplesect>\r
442     <simplesect>\r
443       <title>Object-oriented programming language artifacts</title>\r
444       <para>In addition to the elements listed in <xref linkend="gen_prog_arts"/>, DocBook defines a number of elements that are used \r
445         specifically for object-oriented programming artifacts. They are listed in <xref linkend="oo_arts"/>.</para>\r
446       <table frame="all" xml:id="oo_arts">\r
447         <title>Elements for In-Line OO Programming Artifacts</title>\r
448         <tgroup cols="2">\r
449           <colspec colnum="1" colname="c1" colwidth="1.5in"/>\r
450           <colspec colnum="2" colname="c2"/>\r
451           <thead>\r
452             <row>\r
453               <entry>Element</entry>\r
454               <entry>Description</entry>\r
455             </row>\r
456           </thead>\r
457           <tbody>\r
458             <row>\r
459               <entry><tag class="element">interfacename</tag></entry>\r
460               <entry>Specifies that the artifact is a Java interface the user must implement.</entry>\r
461             </row>\r
462             <row>\r
463               <entry><tag class="element">oointerface</tag></entry>\r
464               <entry>Specifies that the artifact is a Java interface the user must implement. Requires the use of an <tag class="element">modifier</tag> element that contains details about if the interface is public or private.</entry>\r
465             </row>\r
466             <row>\r
467               <entry><tag class="element">classname</tag></entry>\r
468               <entry>Specifies that the artifact is a Java class or an instantiated object.</entry>\r
469             </row>\r
470             <row>\r
471               <entry><tag class="element">ooclass</tag></entry>\r
472               <entry>Specifies that the artifact is a Java class. Requires the use of an <tag class="element">modifier</tag> element that \r
473                 contains details about if the class is public/private or static/final.</entry>\r
474             </row>\r
475             <row>\r
476               <entry><tag class="element">methodname</tag></entry>\r
477               <entry>Specifies that the artifact is a method. Methods are different from functions in that methods are associated with classes and objects.</entry>\r
478             </row>\r
479             <row>\r
480               <entry><tag class="element">ooexception</tag></entry>\r
481               <entry>Specifies that the artifact is a Java exception. Requires the use of an <tag class="element">modifier</tag> element that \r
482                 contains details about if the exception is public or private.</entry>\r
483             </row>\r
484             <row>\r
485               <entry><tag class="element">package</tag></entry>\r
486               <entry>Specifies that the artifact is the name of a Java or C++ package.</entry>\r
487             </row>\r
488           </tbody>\r
489         </tgroup>\r
490       </table>\r
491     </simplesect>\r
492   </section>\r
493 </chapter>