Daniel
Daniel

Reputation: 6039

Javadoc: How to fix: "bad HTML entity" error

I am getting this error:

[ERROR] /Users/daniel/ideaProjects/lbjava/lbjava/src/main/java/edu/illinois/cs/cogcomp/lbjava/learn/NaiveBayes.java:638: error: bad HTML entity
[ERROR] * P(e's label && e)
[ERROR] ^
[ERROR] /Users/daniel/ideaProjects/lbjava/lbjava/src/main/java/edu/illinois/cs/cogcomp/lbjava/learn/NaiveBayes.java:638: error: bad HTML entity
[ERROR] * P(e's label && e)
[ERROR] ^

Here is the full comment:

    /**
     * Takes the dot product of this vector with the given vector, using the specified default
     * weight when encountering a feature that is not yet present in this vector. Here, weights
     * are taken as <i>log(feature count / prior count)</i>. The output of this method is
     * related to the empirical probability of the example <i>e</i> as follows: <br>
     * <br>
     *
     * <i>exp(dot(e)) / (sum of all labels' prior counts)) =</i><br>
     * P(e's label && e)
     *
     * @param exampleFeatures The example's array of feature indices.
     * @param exampleValues The example's array of feature values.
     * @param defaultW The default weight.
     * @return The computed dot product.
     **/

Any ideas what might be causing this error? How can I fix it?

Note: I don't want to disable doclint; instead I want to resolve the issue with the comment.

Upvotes: 7

Views: 5593

Answers (2)

Andrew S
Andrew S

Reputation: 2987

Many of the symbols you use in programming are not valid HTML. As JavaDoc uses HTML one must substitute these with the examples below. This will stop JavaDoc complaining and is the proper way to do it.

&ge;      is >=
&le;      is <=
&gt;      is >
&lt;      is <
&ne;      is !=
&equals;  is =
&amp;     is &
&Vert;    is ||  (double pipe).
&vert;    is |   (Single pipe).

Upvotes: 1

Everspace
Everspace

Reputation: 402

You need to escape some symbols

&& should be entered as &amp;&amp; if you want to render as &&

Upvotes: 19

Related Questions