Share this page 

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>
 */