tags:

views:

52

answers:

3

If I write <xmlElement> in a javadoc, it does not appear, because tags have special funcions on formatting texts.

How can I show this chars in a javadoc?

+4  A: 

Escape them as HTML: &lt; and &gt;

duffymo
+2  A: 

You only need to use the HTML equivalent for one of the angle brackets. The < can be represented as either &lt; or &#60;. Here's a sample taken from real Javadoc:

<pre>
&lt;complexType>
  &lt;complexContent>
    &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      &lt;sequence>
      [...]

This displays as:

<complexType>
   <complexContent>
     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
       <sequence>
Lord Torgamus
A: 

this works for me so use & l t ; for < and & g t ; for > , without any spaces between, because moment i remove spaces stackoverflow thinks them as < and >

Pavitar Singh
you can use the "code" button to format it `<`
Tom Brito
ILMTitan