Reputation: 30147
How to put a sample XML code in Javadoc? The XML code includes angle brackets which I do not want to be processed.
I tried combinations of PRE
and code
but it didn't work.
Upvotes: 16
Views: 6794
Reputation: 7212
You can use @code
javadoc tag. Take a look to this post, wich contains some examples. Hope it helps
/**
* To use this class use this XML
* <pre>
* {@code
* <xml>
* <parameter>foo</parameter>
* <value>bar</value>
* </xml>
* }
* </pre>
*/
Upvotes: 30
Reputation: 1994
You have to use HTML/XML encoding like <
for < and >
for >.
If you use Eclipse, there is a Javadoc view that shows you a preview.
Upvotes: 6