Does Javadoc have an equivalent to <![CDATA[ ... ]]>? Does Javadoc have an equivalent to <![CDATA[ ... ]]>? xml xml

Does Javadoc have an equivalent to <![CDATA[ ... ]]>?


You can use JavaDoc's @code tag: /** This parses {@code <complexType name="">} */


Extending @Fabian's answer, I use both <pre> and {@code ...}. Here an example with XML as source code:

/*Outputs data from a result set to an XML * with following structure: * <pre> * {@code * <row> *  <FIELD1>gregh</FIELD1> *  <FIELD2>487</FIELD2> *  <!-- etc. --> * </row> * <!-- more rows--> * } * </pre> */

<pre> allows you to write code on multiple lines and preserve its structure.

Tested with Eclipse 3.6.1.


Close and reopen the {@code} tag around the braces to get ${dollar_sign_variables} to render correctly in eclipse despite bug 206319 and bug 206345 and without resorting to full HTML escaping:

/* * <pre> * {@code * <outer> *   <inner1>Text</inner1> *   <inner2>$}{ "script" }{@code </inner2> * </outer> * } * </pre> */

which renders in Eclipse Indigo SR2 (3.7.2) as

<outer>  <inner1>Text</inner1>  <inner2>${ "script" }</inner2></outer>