Display XML in a javadocTag(s): Environment

Let's say you have a comment like this
/**
 * To use this class use this XML
 *
 * <xml>
 *   <parameter>foo</parameter>
 *   <value>bar</value>
 * </xml>
 *
 */
The XML will not be visible since it will embedded in the HTML as tag and not as text.

With Javadoc 1.5, you can use the {@code ... } command. :

/**
 * To use this class use this XML
 * <pre>
 * {@code
 * <xml>
 *   <parameter>foo</parameter>
 *   <value>bar</value>
 * </xml>
 * }
 * </pre>
 */
With the previous versions, one way was to add a space after the <.
/**
 * To use this class use this XML
 * <pre>
 * < xml>
 *   < parameter>foo< /parameter>
 *   < value>bar< /value>
 * < /xml>
 * }
 * </pre>
 */



If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]