You can specify equations using <equation>
and also several others, but what tag must be used to specify code? More specifically, PHP, HTML, CSS and Javascript? Is there a plugin that you can use with OxygenXML to add these features automatically? I need to output as PDF.

- 395,085
- 80
- 655
- 663

- 13,479
- 39
- 164
- 296
1 Answers
I'm working on a project which uses docbook, and has examples in PHP.
The examples in PHP are using programlisting
tag, like this :
<programlisting language="php"><![CDATA[<?php
// Here goes the PHP code
]]></programlisting>
Note the language attribute.
It is used later by another tool to add syntax-coloration, when generating the ouput (for HTML output, at least)
For examples that are not specific to one programming language, like configuration files, we are using the screen
tag ; for instance, for a part of an Apache-related config file, an example would be :
<screen><![CDATA[# Setup Listening Port
NameVirtualHost *:80
# Ensure "localhost" is preserved unchanged pointed
# to the default document root for our system.
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www
</VirtualHost>]]></screen>
Quoting their documentations :
A programlisting is a verbatim environment for program source or source fragment listings. The programlistings are often placed in examples or figures so that they can be cross-referenced from the text.
And :
A screen is a verbatim environment for displaying text that the user might see on a computer terminal. It is often used to display the results of a command.
Having less specific semantic overtones, screen is often used wherever a verbatim presentation is desired, but the semantic of programlisting is inappropriate.
So, these two seem quite appropriate.

- 395,085
- 80
- 655
- 663
-
Awesome. Thank you! One question though... if I include something like which is a tag, it doesn't work. Maybe know how to get around that? – rockstardev Aug 14 '09 at 19:11
-
I'm not the one who worked on the build process, so I don't really know ; still, using CDATA should help, in the docbook file. Then, when generating the ouput (HTML output, for instance), you will, probably, need to escape some stuff, or use – Pascal MARTIN Aug 14 '09 at 19:16