< prev index next >

src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java

Print this page

        

@@ -39,44 +39,44 @@
 /**
  * A document that models HTML.  The purpose of this model is to
  * support both browsing and editing.  As a result, the structure
  * described by an HTML document is not exactly replicated by default.
  * The element structure that is modeled by default, is built by the
- * class <code>HTMLDocument.HTMLReader</code>, which implements the
- * <code>HTMLEditorKit.ParserCallback</code> protocol that the parser
+ * class {@code HTMLDocument.HTMLReader}, which implements the
+ * {@code HTMLEditorKit.ParserCallback} protocol that the parser
  * expects.  To change the structure one can subclass
- * <code>HTMLReader</code>, and reimplement the method {@link
+ * {@code HTMLReader}, and reimplement the method {@link
  * #getReader(int)} to return the new reader implementation.  The
- * documentation for <code>HTMLReader</code> should be consulted for
+ * documentation for {@code HTMLReader} should be consulted for
  * the details of the default structure created.  The intent is that
  * the document be non-lossy (although reproducing the HTML format may
  * result in a different format).
  *
  * <p>The document models only HTML, and makes no attempt to store
  * view attributes in it.  The elements are identified by the
- * <code>StyleContext.NameAttribute</code> attribute, which should
- * always have a value of type <code>HTML.Tag</code> that identifies
+ * {@code StyleContext.NameAttribute} attribute, which should
+ * always have a value of type {@code HTML.Tag} that identifies
  * the kind of element.  Some of the elements (such as comments) are
- * synthesized.  The <code>HTMLFactory</code> uses this attribute to
+ * synthesized.  The {@code HTMLFactory} uses this attribute to
  * determine what kind of view to build.</p>
  *
  * <p>This document supports incremental loading.  The
- * <code>TokenThreshold</code> property controls how much of the parse
+ * {@code TokenThreshold} property controls how much of the parse
  * is buffered before trying to update the element structure of the
- * document.  This property is set by the <code>EditorKit</code> so
+ * document.  This property is set by the {@code EditorKit} so
  * that subclasses can disable it.</p>
  *
- * <p>The <code>Base</code> property determines the URL against which
+ * <p>The {@code Base} property determines the URL against which
  * relative URLs are resolved.  By default, this will be the
- * <code>Document.StreamDescriptionProperty</code> if the value of the
+ * {@code Document.StreamDescriptionProperty} if the value of the
  * property is a URL.  If a &lt;BASE&gt; tag is encountered, the base
  * will become the URL specified by that tag.  Because the base URL is
  * a property, it can of course be set directly.</p>
  *
  * <p>The default content storage mechanism for this document is a gap
- * buffer (<code>GapContent</code>).  Alternatives can be supplied by
- * using the constructor that takes a <code>Content</code>
+ * buffer ({@code GapContent}).  Alternatives can be supplied by
+ * using the constructor that takes a {@code Content}
  * implementation.</p>
  *
  * <h2>Modifying HTMLDocument</h2>
  *
  * <p>In addition to the methods provided by Document and

@@ -104,96 +104,99 @@
  * HTMLDocument d = (HTMLDocument) p.getDocument();
  * </pre>
  *
  * <p>With the following HTML content:</p>
  *
- * <pre>
- * &lt;html&gt;
- *   &lt;head&gt;
- *     &lt;title&gt;An example HTMLDocument&lt;/title&gt;
- *     &lt;style type="text/css"&gt;
+ * <pre>{@code
+ * <html>
+ *   <head>
+ *     <title>An example HTMLDocument</title>
+ *     <style type="text/css">
  *       div { background-color: silver; }
  *       ul { color: red; }
- *     &lt;/style&gt;
- *   &lt;/head&gt;
- *   &lt;body&gt;
- *     &lt;div id="BOX"&gt;
- *       &lt;p&gt;Paragraph 1&lt;/p&gt;
- *       &lt;p&gt;Paragraph 2&lt;/p&gt;
- *     &lt;/div&gt;
- *   &lt;/body&gt;
- * &lt;/html&gt;
- * </pre>
+ *     </style>
+ *   </head>
+ *   <body>
+ *     <div id="BOX">
+ *       <p>Paragraph 1</p>
+ *       <p>Paragraph 2</p>
+ *     </div>
+ *   </body>
+ * </html>
+ * }</pre>
  *
  * <p>All the methods for modifying an HTML document require an {@link
  * Element}.  Elements can be obtained from an HTML document by using
  * the method {@link #getElement(Element e, Object attribute, Object
  * value)}.  It returns the first descendant element that contains the
  * specified attribute with the given value, in depth-first order.
- * For example, <code>d.getElement(d.getDefaultRootElement(),
- * StyleConstants.NameAttribute, HTML.Tag.P)</code> returns the first
+ * For example, {@code d.getElement(d.getDefaultRootElement(),
+ * StyleConstants.NameAttribute, HTML.Tag.P)} returns the first
  * paragraph element.</p>
  *
  * <p>A convenient shortcut for locating elements is the method {@link
- * #getElement(String)}; returns an element whose <code>ID</code>
+ * #getElement(String)}; returns an element whose {@code ID}
  * attribute matches the specified value.  For example,
- * <code>d.getElement("BOX")</code> returns the <code>DIV</code>
+ * {@code d.getElement("BOX")} returns the {@code DIV}
  * element.</p>
  *
  * <p>The {@link #getIterator(HTML.Tag t)} method can also be used for
  * finding all occurrences of the specified HTML tag in the
  * document.</p>
  *
  * <h3>Inserting elements</h3>
  *
  * <p>Elements can be inserted before or after the existing children
  * of any non-leaf element by using the methods
- * <code>insertAfterStart</code> and <code>insertBeforeEnd</code>.
- * For example, if <code>e</code> is the <code>DIV</code> element,
- * <code>d.insertAfterStart(e, "&lt;ul&gt;&lt;li&gt;List
- * Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list before the first
- * paragraph, and <code>d.insertBeforeEnd(e, "&lt;ul&gt;&lt;li&gt;List
- * Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list after the last
- * paragraph.  The <code>DIV</code> block becomes the parent of the
+ * {@code insertAfterStart} and {@code insertBeforeEnd}.
+ * For example, if {@code e} is the {@code DIV} element,
+ * {@code d.insertAfterStart(e, "<ul><li>List Item</li></ul>")}
+ * inserts the list before the first
+ * paragraph, and 
+ * {@code d.insertBeforeEnd(e, "<ul><li>List Item</li></ul>")}
+ * inserts the list after the last
+ * paragraph.  The {@code DIV} block becomes the parent of the
  * newly inserted elements.</p>
  *
  * <p>Sibling elements can be inserted before or after any element by
- * using the methods <code>insertBeforeStart</code> and
- * <code>insertAfterEnd</code>.  For example, if <code>e</code> is the
- * <code>DIV</code> element, <code>d.insertBeforeStart(e,
- * "&lt;ul&gt;&lt;li&gt;List Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list
- * before the <code>DIV</code> element, and <code>d.insertAfterEnd(e,
- * "&lt;ul&gt;&lt;li&gt;List Item&lt;/li&gt;&lt;/ul&gt;")</code> inserts the list
- * after the <code>DIV</code> element.  The newly inserted elements
- * become siblings of the <code>DIV</code> element.</p>
+ * using the methods {@code insertBeforeStart} and
+ * {@code insertAfterEnd}.  For example, if {@code e} is the
+ * {@code DIV} element,
+ * {@code d.insertBeforeStart(e, "<ul><li>List Item</li></ul>")}
+ * inserts the list before the {@code DIV} element, and
+ * {@code d.insertAfterEnd(e, "<ul><li>List Item</li></ul>")}
+ * inserts the list after the {@code DIV} element.
+ * The newly inserted elements
+ * become siblings of the {@code DIV} element.</p>
  *
  * <h3>Replacing elements</h3>
  *
  * <p>Elements and all their descendants can be replaced by using the
- * methods <code>setInnerHTML</code> and <code>setOuterHTML</code>.
- * For example, if <code>e</code> is the <code>DIV</code> element,
- * <code>d.setInnerHTML(e, "&lt;ul&gt;&lt;li&gt;List
- * Item&lt;/li&gt;&lt;/ul&gt;")</code> replaces all children paragraphs with
- * the list, and <code>d.setOuterHTML(e, "&lt;ul&gt;&lt;li&gt;List
- * Item&lt;/li&gt;&lt;/ul&gt;")</code> replaces the <code>DIV</code> element
+ * methods {@code setInnerHTML} and {@code setOuterHTML}.
+ * For example, if {@code e} is the {@code DIV} element,
+ * {@code d.setInnerHTML(e, "<ul><li>List Item</li></ul>")}
+ * replaces all children paragraphs with
+ * the list, and
+ * {@code d.setOuterHTML(e, "<ul><li>List Item</li></ul>")}
+ * replaces the {@code DIV} element
  * itself.  In latter case the parent of the list is the
- * <code>BODY</code> element.
+ * {@code BODY} element.
  *
  * <h3>Summary</h3>
  *
  * <p>The following table shows the example document and the results
  * of various methods described above.</p>
  *
  * <table border=1 cellspacing=0 summary="HTML Content of example above">
  *   <tr>
  *     <th>Example</th>
- *     <th><code>insertAfterStart</code></th>
- *     <th><code>insertBeforeEnd</code></th>
- *     <th><code>insertBeforeStart</code></th>
- *     <th><code>insertAfterEnd</code></th>
- *     <th><code>setInnerHTML</code></th>
- *     <th><code>setOuterHTML</code></th>
+ *     <th>{@code insertAfterStart}</th>
+ *     <th>{@code insertBeforeEnd}</th>
+ *     <th>{@code insertBeforeStart}</th>
+ *     <th>{@code insertAfterEnd}</th>
+ *     <th>{@code setInnerHTML}</th>
+ *     <th>{@code setOuterHTML}</th>
  *   </tr>
  *   <tr valign="top">
  *     <td style="white-space:nowrap">
  *       <div style="background-color: silver;">
  *         <p>Paragraph 1</p>

@@ -261,35 +264,35 @@
  * not be compatible with future Swing releases. The current
  * serialization support is appropriate for short term storage or RMI
  * between applications running the same version of Swing.  As of 1.4,
  * support for long term storage of all JavaBeans&trade;
  * has been added to the
- * <code>java.beans</code> package.  Please see {@link
+ * {@code java.beans} package.  Please see {@link
  * java.beans.XMLEncoder}.</p>
  *
  * @author  Timothy Prinzing
  * @author  Scott Violet
  * @author  Sunita Mani
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class HTMLDocument extends DefaultStyledDocument {
     /**
      * Constructs an HTML document using the default buffer size
-     * and a default <code>StyleSheet</code>.  This is a convenience
+     * and a default {@code StyleSheet}.  This is a convenience
      * method for the constructor
-     * <code>HTMLDocument(Content, StyleSheet)</code>.
+     * {@code HTMLDocument(Content, StyleSheet)}.
      */
     public HTMLDocument() {
         this(new GapContent(BUFFER_SIZE_DEFAULT), new StyleSheet());
     }
 
     /**
      * Constructs an HTML document with the default content
      * storage implementation and the specified style/attribute
      * storage mechanism.  This is a convenience method for the
      * constructor
-     * <code>HTMLDocument(Content, StyleSheet)</code>.
+     * {@code HTMLDocument(Content, StyleSheet)}.
      *
      * @param styles  the styles
      */
     public HTMLDocument(StyleSheet styles) {
         this(new GapContent(BUFFER_SIZE_DEFAULT), styles);

@@ -308,11 +311,11 @@
     }
 
     /**
      * Fetches the reader for the parser to use when loading the document
      * with HTML.  This is implemented to return an instance of
-     * <code>HTMLDocument.HTMLReader</code>.
+     * {@code HTMLDocument.HTMLReader}.
      * Subclasses can reimplement this
      * method to change how the document gets structured if desired.
      * (For example, to handle custom tags, or structurally represent character
      * style elements.)
      *

@@ -329,23 +332,23 @@
     }
 
     /**
      * Returns the reader for the parser to use to load the document
      * with HTML.  This is implemented to return an instance of
-     * <code>HTMLDocument.HTMLReader</code>.
+     * {@code HTMLDocument.HTMLReader}.
      * Subclasses can reimplement this
      * method to change how the document gets structured if desired.
      * (For example, to handle custom tags, or structurally represent character
      * style elements.)
      * <p>This is a convenience method for
-     * <code>getReader(int, int, int, HTML.Tag, TRUE)</code>.
+     * {@code getReader(int, int, int, HTML.Tag, TRUE)}.
      *
      * @param pos the starting position
-     * @param popDepth   the number of <code>ElementSpec.EndTagTypes</code>
+     * @param popDepth   the number of {@code ElementSpec.EndTagTypes}
      *          to generate before inserting
-     * @param pushDepth  the number of <code>ElementSpec.StartTagTypes</code>
-     *          with a direction of <code>ElementSpec.JoinNextDirection</code>
+     * @param pushDepth  the number of {@code ElementSpec.StartTagTypes}
+     *          with a direction of {@code ElementSpec.JoinNextDirection}
      *          that should be generated before inserting,
      *          but after the end tags have been generated
      * @param insertTag  the first tag to start inserting into document
      * @return the reader used by the parser to load the document
      */

@@ -361,14 +364,14 @@
      * HTMLDocument.HTMLReader.  Subclasses can reimplement this
      * method to change how the document get structured if desired
      * (e.g. to handle custom tags, structurally represent character
      * style elements, etc.).
      *
-     * @param popDepth   the number of <code>ElementSpec.EndTagTypes</code>
+     * @param popDepth   the number of {@code ElementSpec.EndTagTypes}
      *          to generate before inserting
-     * @param pushDepth  the number of <code>ElementSpec.StartTagTypes</code>
-     *          with a direction of <code>ElementSpec.JoinNextDirection</code>
+     * @param pushDepth  the number of {@code ElementSpec.StartTagTypes}
+     *          with a direction of {@code ElementSpec.JoinNextDirection}
      *          that should be generated before inserting,
      *          but after the end tags have been generated
      * @param insertTag  the first tag to start inserting into document
      * @param insertInsertTag  false if all the Elements after insertTag should
      *        be inserted; otherwise insertTag will be inserted

@@ -403,12 +406,12 @@
     /**
      * Sets the location to resolve relative URLs against.  By
      * default this will be the document's URL if the document
      * was loaded from a URL.  If a base tag is found and
      * can be parsed, it will be used as the base location.
-     * <p>This also sets the base of the <code>StyleSheet</code>
-     * to be <code>u</code> as well as the base of the document.
+     * <p>This also sets the base of the {@code StyleSheet}
+     * to be {@code u} as well as the base of the document.
      *
      * @param u  the desired base URL
      */
     public void setBase(URL u) {
         base = u;

@@ -522,14 +525,14 @@
             writeUnlock();
         }
     }
 
     /**
-     * Fetches the <code>StyleSheet</code> with the document-specific display
+     * Fetches the {@code StyleSheet} with the document-specific display
      * rules (CSS) that were specified in the HTML document itself.
      *
-     * @return the <code>StyleSheet</code>
+     * @return the {@code StyleSheet}
      */
     public StyleSheet getStyleSheet() {
         return (StyleSheet) getAttributeContext();
     }
 

@@ -537,12 +540,12 @@
      * Fetches an iterator for the specified HTML tag.
      * This can be used for things like iterating over the
      * set of anchors contained, or iterating over the input
      * elements.
      *
-     * @param t the requested <code>HTML.Tag</code>
-     * @return the <code>Iterator</code> for the given HTML tag
+     * @param t the requested {@code HTML.Tag}
+     * @return the {@code Iterator} for the given HTML tag
      * @see javax.swing.text.html.HTML.Tag
      */
     public Iterator getIterator(HTML.Tag t) {
         if (t.isBlock()) {
             // TBD

@@ -553,11 +556,11 @@
 
     /**
      * Creates a document leaf element that directly represents
      * text (doesn't have any children).  This is implemented
      * to return an element of type
-     * <code>HTMLDocument.RunElement</code>.
+     * {@code HTMLDocument.RunElement}.
      *
      * @param parent the parent element
      * @param a the attributes for the element
      * @param p0 the beginning of the range (must be at least 0)
      * @param p1 the end of the range (must be at least p0)

@@ -568,11 +571,11 @@
     }
 
     /**
      * Creates a document branch element, that can contain other elements.
      * This is implemented to return an element of type
-     * <code>HTMLDocument.BlockElement</code>.
+     * {@code HTMLDocument.BlockElement}.
      *
      * @param parent the parent element
      * @param a the attributes
      * @return the element
      */

@@ -627,11 +630,11 @@
     }
 
     /**
      * Gets the number of tokens to buffer before trying to update
      * the documents element structure.  The default value is
-     * <code>Integer.MAX_VALUE</code>.
+     * {@code Integer.MAX_VALUE}.
      *
      * @return the number of tokens to buffer
      */
     public int getTokenThreshold() {
         Integer i = (Integer) getProperty(TokenThreshold);

@@ -664,16 +667,16 @@
     public boolean getPreservesUnknownTags() {
         return preservesUnknownTags;
     }
 
     /**
-     * Processes <code>HyperlinkEvents</code> that
+     * Processes {@code HyperlinkEvents} that
      * are generated by documents in an HTML frame.
-     * The <code>HyperlinkEvent</code> type, as the parameter suggests,
-     * is <code>HTMLFrameHyperlinkEvent</code>.
+     * The {@code HyperlinkEvent} type, as the parameter suggests,
+     * is {@code HTMLFrameHyperlinkEvent}.
      * In addition to the typical information contained in a
-     * <code>HyperlinkEvent</code>,
+     * {@code HyperlinkEvent},
      * this event contains the element that corresponds to the frame in
      * which the click happened (the source element) and the
      * target name.  The target name has 4 possible values:
      * <ul>
      * <li>  _self

@@ -681,29 +684,29 @@
      * <li>  _top
      * <li>  a named frame
      * </ul>
      *
      * If target is _self, the action is to change the value of the
-     * <code>HTML.Attribute.SRC</code> attribute and fires a
-     * <code>ChangedUpdate</code> event.
+     * {@code HTML.Attribute.SRC} attribute and fires a
+     * {@code ChangedUpdate} event.
      *<p>
      * If the target is _parent, then it deletes the parent element,
      * which is a &lt;FRAMESET&gt; element, and inserts a new &lt;FRAME&gt;
-     * element, and sets its <code>HTML.Attribute.SRC</code> attribute
+     * element, and sets its {@code HTML.Attribute.SRC} attribute
      * to have a value equal to the destination URL and fire a
-     * <code>RemovedUpdate</code> and <code>InsertUpdate</code>.
+     * {@code RemovedUpdate} and {@code InsertUpdate}.
      *<p>
      * If the target is _top, this method does nothing. In the implementation
-     * of the view for a frame, namely the <code>FrameView</code>,
+     * of the view for a frame, namely the {@code FrameView},
      * the processing of _top is handled.  Given that _top implies
      * replacing the entire document, it made sense to handle this outside
      * of the document that it will replace.
      *<p>
      * If the target is a named frame, then the element hierarchy is searched
      * for an element with a name equal to the target, its
-     * <code>HTML.Attribute.SRC</code> attribute is updated and a
-     * <code>ChangedUpdate</code> event is fired.
+     * {@code HTML.Attribute.SRC} attribute is updated and a
+     * {@code ChangedUpdate} event is fired.
      *
      * @param e the event
      */
     public void processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent e) {
         String frameName = e.getTarget();

@@ -733,15 +736,15 @@
     }
 
 
     /**
      * Searches the element hierarchy for an FRAME element
-     * that has its name attribute equal to the <code>frameName</code>.
+     * that has its name attribute equal to the {@code frameName}.
      *
      * @param frameName
      * @return the element whose NAME attribute has a value of
-     *          <code>frameName</code>; returns <code>null</code>
+     *          {@code frameName}; returns {@code null}
      *          if not found
      */
     private Element findFrame(String frameName) {
         ElementIterator it = new ElementIterator(this);
         Element next;

@@ -757,11 +760,11 @@
         }
         return next;
     }
 
     /**
-     * Returns true if <code>StyleConstants.NameAttribute</code> is
+     * Returns true if {@code StyleConstants.NameAttribute} is
      * equal to the tag that is passed in as a parameter.
      *
      * @param attr the attributes to be matched
      * @param tag the value to be matched
      * @return true if there is a match, false otherwise

@@ -803,12 +806,12 @@
         }
     }
 
 
     /**
-     * Updates the Frame elements <code>HTML.Attribute.SRC attribute</code>
-     * and fires a <code>ChangedUpdate</code> event.
+     * Updates the Frame elements {@code HTML.Attribute.SRC attribute}
+     * and fires a {@code ChangedUpdate} event.
      *
      * @param element a FRAME element whose SRC attribute will be updated
      * @param url     a string specifying the new value for the SRC attribute
      */
     private void updateFrame(Element element, String url) {

@@ -852,11 +855,11 @@
 
     /**
      * Adds the specified map, this will remove a Map that has been
      * previously registered with the same name.
      *
-     * @param map  the <code>Map</code> to be registered
+     * @param map  the {@code Map} to be registered
      */
     void addMap(Map map) {
         String     name = map.getName();
 
         if (name != null) {

@@ -874,11 +877,11 @@
         }
     }
 
     /**
      * Removes a previously registered map.
-     * @param map the <code>Map</code> to be removed
+     * @param map the {@code Map} to be removed
      */
     void removeMap(Map map) {
         String     name = map.getName();
 
         if (name != null) {

@@ -890,13 +893,13 @@
         }
     }
 
     /**
      * Returns the Map associated with the given name.
-     * @param name the name of the desired <code>Map</code>
-     * @return the <code>Map</code> or <code>null</code> if it can't
-     *          be found, or if <code>name</code> is <code>null</code>
+     * @param name the name of the desired {@code Map}
+     * @return the {@code Map} or {@code null} if it can't
+     *          be found, or if {@code name} is {@code null}
      */
     Map getMap(String name) {
         if (name != null) {
             Object     maps = getProperty(MAP_PROPERTY);
 

@@ -906,13 +909,13 @@
         }
         return null;
     }
 
     /**
-     * Returns an <code>Enumeration</code> of the possible Maps.
-     * @return the enumerated list of maps, or <code>null</code>
-     *          if the maps are not an instance of <code>Hashtable</code>
+     * Returns an {@code Enumeration} of the possible Maps.
+     * @return the enumerated list of maps, or {@code null}
+     *          if the maps are not an instance of {@code Hashtable}
      */
     Enumeration<Object> getMaps() {
         Object     maps = getProperty(MAP_PROPERTY);
 
         if (maps instanceof Hashtable) {

@@ -947,15 +950,15 @@
         return retValue;
     }
 
     /**
      * Sets the parser that is used by the methods that insert html
-     * into the existing document, such as <code>setInnerHTML</code>,
-     * and <code>setOuterHTML</code>.
+     * into the existing document, such as {@code setInnerHTML},
+     * and {@code setOuterHTML}.
      * <p>
-     * <code>HTMLEditorKit.createDefaultDocument</code> will set the parser
-     * for you. If you create an <code>HTMLDocument</code> by hand,
+     * {@code HTMLEditorKit.createDefaultDocument} will set the parser
+     * for you. If you create an {@code HTMLDocument} by hand,
      * be sure and set the parser accordingly.
      * @param parser the parser to be used for text insertion
      *
      * @since 1.3
      */

@@ -985,22 +988,22 @@
      * specified as an HTML string.
      *
      * <p>This will be seen as at least two events, n inserts followed by
      * a remove.</p>
      *
-     * <p>Consider the following structure (the <code>elem</code>
+     * <p>Consider the following structure (the {@code elem}
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *      /  \
      *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>setInnerHTML(elem, "&lt;ul&gt;&lt;li&gt;")</code>
+     * <p>Invoking {@code setInnerHTML(elem, "<ul><li>")}
      * results in the following structure (new elements are <font
      * style="color: red;">in red</font>).</p>
      *
      * <pre>
      *     &lt;body&gt;

@@ -1010,24 +1013,24 @@
      *         <font style="color: red;">&lt;ul&gt;</font>
      *           \
      *           <font style="color: red;">&lt;li&gt;</font>
      * </pre>
      *
-     * <p>Parameter <code>elem</code> must not be a leaf element,
-     * otherwise an <code>IllegalArgumentException</code> is thrown.
-     * If either <code>elem</code> or <code>htmlText</code> parameter
-     * is <code>null</code>, no changes are made to the document.</p>
+     * <p>Parameter {@code elem} must not be a leaf element,
+     * otherwise an {@code IllegalArgumentException} is thrown.
+     * If either {@code elem} or {@code htmlText} parameter
+     * is {@code null}, no changes are made to the document.</p>
      *
      * <p>For this to work correctly, the document must have an
-     * <code>HTMLEditorKit.Parser</code> set. This will be the case
+     * {@code HTMLEditorKit.Parser} set. This will be the case
      * if the document was created from an HTMLEditorKit via the
-     * <code>createDefaultDocument</code> method.</p>
+     * {@code createDefaultDocument} method.</p>
      *
      * @param elem the branch element whose children will be replaced
-     * @param htmlText the string to be parsed and assigned to <code>elem</code>
-     * @throws IllegalArgumentException if <code>elem</code> is a leaf
-     * @throws IllegalStateException if an <code>HTMLEditorKit.Parser</code>
+     * @param htmlText the string to be parsed and assigned to {@code elem}
+     * @throws IllegalArgumentException if {@code elem} is a leaf
+     * @throws IllegalStateException if an {@code HTMLEditorKit.Parser}
      *         has not been defined
      * @throws BadLocationException if replacement is impossible because of
      *         a structural issue
      * @throws IOException if an I/O exception occurs
      * @since 1.3

@@ -1064,27 +1067,27 @@
      * element that contained a newline with &lt;img&gt; this would create
      * two elements, one for the image, and one for the newline.</p>
      *
      * <p>If you try to replace the element at length you will most
      * likely end up with two elements, eg
-     * <code>setOuterHTML(getCharacterElement (getLength()),
-     * "blah")</code> will result in two leaf elements at the end, one
+     * {@code setOuterHTML(getCharacterElement (getLength()), "blah")}
+     * will result in two leaf elements at the end, one
      * representing 'blah', and the other representing the end
      * element.</p>
      *
-     * <p>Consider the following structure (the <code>elem</code>
+     * <p>Consider the following structure (the {@code elem}
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *      /  \
      *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>setOuterHTML(elem, "&lt;ul&gt;&lt;li&gt;")</code>
+     * <p>Invoking {@code setOuterHTML(elem, "<ul><li>")}
      * results in the following structure (new elements are <font
      * style="color: red;">in red</font>).</p>
      *
      * <pre>
      *    &lt;body&gt;

@@ -1092,21 +1095,21 @@
      *     <font style="color: red;">&lt;ul&gt;</font>
      *       \
      *       <font style="color: red;">&lt;li&gt;</font>
      * </pre>
      *
-     * <p>If either <code>elem</code> or <code>htmlText</code>
-     * parameter is <code>null</code>, no changes are made to the
+     * <p>If either {@code elem} or {@code htmlText}
+     * parameter is {@code null}, no changes are made to the
      * document.</p>
      *
      * <p>For this to work correctly, the document must have an
      * HTMLEditorKit.Parser set. This will be the case if the document
      * was created from an HTMLEditorKit via the
-     * <code>createDefaultDocument</code> method.</p>
+     * {@code createDefaultDocument} method.</p>
      *
      * @param elem the element to replace
-     * @param htmlText the string to be parsed and inserted in place of <code>elem</code>
+     * @param htmlText the string to be parsed and inserted in place of {@code elem}
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set
      * @throws BadLocationException if replacement is impossible because of
      *         a structural issue
      * @throws IOException if an I/O exception occurs

@@ -1142,23 +1145,24 @@
 
     /**
      * Inserts the HTML specified as a string at the start
      * of the element.
      *
-     * <p>Consider the following structure (the <code>elem</code>
+     * <p>Consider the following structure (the {@code elem}
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *      /  \
      *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>insertAfterStart(elem,
-     * "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure
+     * <p>Invoking
+     * {@code insertAfterStart(elem, "<ul><li>")}
+     * results in the following structure
      * (new elements are <font style="color: red;">in red</font>).</p>
      *
      * <pre>
      *        &lt;body&gt;
      *          |

@@ -1167,27 +1171,27 @@
      *    <font style="color: red;">&lt;ul&gt;</font> &lt;p&gt; &lt;p&gt;
      *     /
      *  <font style="color: red;">&lt;li&gt;</font>
      * </pre>
      *
-     * <p>Unlike the <code>insertBeforeStart</code> method, new
+     * <p>Unlike the {@code insertBeforeStart} method, new
      *  elements become <em>children</em> of the specified element,
      *  not siblings.</p>
      *
-     * <p>Parameter <code>elem</code> must not be a leaf element,
-     * otherwise an <code>IllegalArgumentException</code> is thrown.
-     * If either <code>elem</code> or <code>htmlText</code> parameter
-     * is <code>null</code>, no changes are made to the document.</p>
+     * <p>Parameter {@code elem} must not be a leaf element,
+     * otherwise an {@code IllegalArgumentException} is thrown.
+     * If either {@code elem} or {@code htmlText} parameter
+     * is {@code null}, no changes are made to the document.</p>
      *
      * <p>For this to work correctly, the document must have an
-     * <code>HTMLEditorKit.Parser</code> set. This will be the case
+     * {@code HTMLEditorKit.Parser} set. This will be the case
      * if the document was created from an HTMLEditorKit via the
-     * <code>createDefaultDocument</code> method.</p>
+     * {@code createDefaultDocument} method.</p>
      *
      * @param elem the branch element to be the root for the new text
-     * @param htmlText the string to be parsed and assigned to <code>elem</code>
-     * @throws IllegalArgumentException if <code>elem</code> is a leaf
+     * @param htmlText the string to be parsed and assigned to {@code elem}
+     * @throws IllegalArgumentException if {@code elem} is a leaf
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
      * @throws BadLocationException if insertion is impossible because of
      *         a structural issue
      * @throws IOException if an I/O exception occurs

@@ -1210,27 +1214,27 @@
 
     /**
      * Inserts the HTML specified as a string at the end of
      * the element.
      *
-     * <p> If <code>elem</code>'s children are leaves, and the
-     * character at a <code>elem.getEndOffset() - 1</code> is a newline,
+     * <p> If {@code elem}'s children are leaves, and the
+     * character at a {@code elem.getEndOffset() - 1} is a newline,
      * this will insert before the newline so that there isn't text after
      * the newline.</p>
      *
-     * <p>Consider the following structure (the <code>elem</code>
+     * <p>Consider the following structure (the {@code elem}
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *      /  \
      *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>insertBeforeEnd(elem, "&lt;ul&gt;&lt;li&gt;")</code>
+     * <p>Invoking {@code insertBeforeEnd(elem, "<ul><li>")}
      * results in the following structure (new elements are <font
      * style="color: red;">in red</font>).</p>
      *
      * <pre>
      *        &lt;body&gt;

@@ -1240,27 +1244,27 @@
      *     &lt;p&gt; &lt;p&gt; <font style="color: red;">&lt;ul&gt;</font>
      *               \
      *               <font style="color: red;">&lt;li&gt;</font>
      * </pre>
      *
-     * <p>Unlike the <code>insertAfterEnd</code> method, new elements
+     * <p>Unlike the {@code insertAfterEnd} method, new elements
      * become <em>children</em> of the specified element, not
      * siblings.</p>
      *
-     * <p>Parameter <code>elem</code> must not be a leaf element,
-     * otherwise an <code>IllegalArgumentException</code> is thrown.
-     * If either <code>elem</code> or <code>htmlText</code> parameter
-     * is <code>null</code>, no changes are made to the document.</p>
+     * <p>Parameter {@code elem} must not be a leaf element,
+     * otherwise an {@code IllegalArgumentException} is thrown.
+     * If either {@code elem} or {@code htmlText} parameter
+     * is {@code null}, no changes are made to the document.</p>
      *
      * <p>For this to work correctly, the document must have an
-     * <code>HTMLEditorKit.Parser</code> set. This will be the case
+     * {@code HTMLEditorKit.Parser} set. This will be the case
      * if the document was created from an HTMLEditorKit via the
-     * <code>createDefaultDocument</code> method.</p>
+     * {@code createDefaultDocument} method.</p>
      *
      * @param elem the element to be the root for the new text
-     * @param htmlText the string to be parsed and assigned to <code>elem</code>
-     * @throws IllegalArgumentException if <code>elem</code> is a leaf
+     * @param htmlText the string to be parsed and assigned to {@code elem}
+     * @throws IllegalArgumentException if {@code elem} is a leaf
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
      * @throws BadLocationException if insertion is impossible because of
      *         a structural issue
      * @throws IOException if an I/O exception occurs

@@ -1285,48 +1289,49 @@
 
     /**
      * Inserts the HTML specified as a string before the start of
      * the given element.
      *
-     * <p>Consider the following structure (the <code>elem</code>
+     * <p>Consider the following structure (the {@code elem}
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *      /  \
      *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>insertBeforeStart(elem,
-     * "&lt;ul&gt;&lt;li&gt;")</code> results in the following structure
+     * <p>Invoking
+     * {@code insertBeforeStart(elem, "<ul><li>")}
+     * results in the following structure
      * (new elements are <font style="color: red;">in red</font>).</p>
      *
      * <pre>
      *        &lt;body&gt;
      *         /  \
      *      <font style="color: red;">&lt;ul&gt;</font> <b>&lt;div&gt;</b>
      *       /    /  \
      *     <font style="color: red;">&lt;li&gt;</font> &lt;p&gt;  &lt;p&gt;
      * </pre>
      *
-     * <p>Unlike the <code>insertAfterStart</code> method, new
+     * <p>Unlike the {@code insertAfterStart} method, new
      * elements become <em>siblings</em> of the specified element, not
      * children.</p>
      *
-     * <p>If either <code>elem</code> or <code>htmlText</code>
-     * parameter is <code>null</code>, no changes are made to the
+     * <p>If either {@code elem} or {@code htmlText}
+     * parameter is {@code null}, no changes are made to the
      * document.</p>
      *
      * <p>For this to work correctly, the document must have an
-     * <code>HTMLEditorKit.Parser</code> set. This will be the case
+     * {@code HTMLEditorKit.Parser} set. This will be the case
      * if the document was created from an HTMLEditorKit via the
-     * <code>createDefaultDocument</code> method.</p>
+     * {@code createDefaultDocument} method.</p>
      *
      * @param elem the element the content is inserted before
-     * @param htmlText the string to be parsed and inserted before <code>elem</code>
+     * @param htmlText the string to be parsed and inserted before {@code elem}
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
      * @throws BadLocationException if insertion is impossible because of
      *         a structural issue
      * @throws IOException if an I/O exception occurs

@@ -1346,22 +1351,22 @@
 
     /**
      * Inserts the HTML specified as a string after the end of the
      * given element.
      *
-     * <p>Consider the following structure (the <code>elem</code>
+     * <p>Consider the following structure (the {@code elem}
      * parameter is <b>in bold</b>).</p>
      *
      * <pre>
      *     &lt;body&gt;
      *       |
      *     <b>&lt;div&gt;</b>
      *      /  \
      *    &lt;p&gt;   &lt;p&gt;
      * </pre>
      *
-     * <p>Invoking <code>insertAfterEnd(elem, "&lt;ul&gt;&lt;li&gt;")</code>
+     * <p>Invoking {@code insertAfterEnd(elem, "<ul><li>")}
      * results in the following structure (new elements are <font
      * style="color: red;">in red</font>).</p>
      *
      * <pre>
      *        &lt;body&gt;

@@ -1369,25 +1374,25 @@
      *      <b>&lt;div&gt;</b> <font style="color: red;">&lt;ul&gt;</font>
      *       / \    \
      *     &lt;p&gt; &lt;p&gt;  <font style="color: red;">&lt;li&gt;</font>
      * </pre>
      *
-     * <p>Unlike the <code>insertBeforeEnd</code> method, new elements
+     * <p>Unlike the {@code insertBeforeEnd} method, new elements
      * become <em>siblings</em> of the specified element, not
      * children.</p>
      *
-     * <p>If either <code>elem</code> or <code>htmlText</code>
-     * parameter is <code>null</code>, no changes are made to the
+     * <p>If either {@code elem} or {@code htmlText}
+     * parameter is {@code null}, no changes are made to the
      * document.</p>
      *
      * <p>For this to work correctly, the document must have an
-     * <code>HTMLEditorKit.Parser</code> set. This will be the case
+     * {@code HTMLEditorKit.Parser} set. This will be the case
      * if the document was created from an HTMLEditorKit via the
-     * <code>createDefaultDocument</code> method.</p>
+     * {@code createDefaultDocument} method.</p>
      *
      * @param elem the element the content is inserted after
-     * @param htmlText the string to be parsed and inserted after <code>elem</code>
+     * @param htmlText the string to be parsed and inserted after {@code elem}
      * @throws IllegalStateException if an HTMLEditorKit.Parser has not
      *         been set on the document
      * @throws BadLocationException if insertion is impossible because of
      *         a structural issue
      * @throws IOException if an I/O exception occurs

@@ -1421,24 +1426,24 @@
             }
         }
     }
 
     /**
-     * Returns the element that has the given id <code>Attribute</code>.
-     * If the element can't be found, <code>null</code> is returned.
-     * Note that this method works on an <code>Attribute</code>,
+     * Returns the element that has the given id {@code Attribute}.
+     * If the element can't be found, {@code null} is returned.
+     * Note that this method works on an {@code Attribute},
      * <i>not</i> a character tag.  In the following HTML snippet:
-     * <code>&lt;a id="HelloThere"&gt;</code> the attribute is
+     * {@code <a id="HelloThere">} the attribute is
      * 'id' and the character tag is 'a'.
      * This is a convenience method for
-     * <code>getElement(RootElement, HTML.Attribute.id, id)</code>.
+     * {@code getElement(RootElement, HTML.Attribute.id, id)}.
      * This is not thread-safe.
      *
-     * @param id  the string representing the desired <code>Attribute</code>
-     * @return the element with the specified <code>Attribute</code>
-     *          or <code>null</code> if it can't be found,
-     *          or <code>null</code> if <code>id</code> is <code>null</code>
+     * @param id  the string representing the desired {@code Attribute}
+     * @return the element with the specified {@code Attribute}
+     *          or {@code null} if it can't be found,
+     *          or {@code null} if {@code id} is {@code null}
      * @see javax.swing.text.html.HTML.Attribute
      * @since 1.3
      */
     public Element getElement(String id) {
         if (id == null) {

@@ -1447,41 +1452,41 @@
         return getElement(getDefaultRootElement(), HTML.Attribute.ID, id,
                           true);
     }
 
     /**
-     * Returns the child element of <code>e</code> that contains the
-     * attribute, <code>attribute</code> with value <code>value</code>, or
-     * <code>null</code> if one isn't found. This is not thread-safe.
+     * Returns the child element of {@code e} that contains the
+     * attribute, {@code attribute} with value {@code value}, or
+     * {@code null} if one isn't found. This is not thread-safe.
      *
      * @param e the root element where the search begins
-     * @param attribute the desired <code>Attribute</code>
-     * @param value the values for the specified <code>Attribute</code>
-     * @return the element with the specified <code>Attribute</code>
-     *          and the specified <code>value</code>, or <code>null</code>
+     * @param attribute the desired {@code Attribute}
+     * @param value the values for the specified {@code Attribute}
+     * @return the element with the specified {@code Attribute}
+     *          and the specified {@code value}, or {@code null}
      *          if it can't be found
      * @see javax.swing.text.html.HTML.Attribute
      * @since 1.3
      */
     public Element getElement(Element e, Object attribute, Object value) {
         return getElement(e, attribute, value, true);
     }
 
     /**
-     * Returns the child element of <code>e</code> that contains the
-     * attribute, <code>attribute</code> with value <code>value</code>, or
-     * <code>null</code> if one isn't found. This is not thread-safe.
+     * Returns the child element of {@code e} that contains the
+     * attribute, {@code attribute} with value {@code value}, or
+     * {@code null} if one isn't found. This is not thread-safe.
      * <p>
-     * If <code>searchLeafAttributes</code> is true, and <code>e</code> is
-     * a leaf, any attributes that are instances of <code>HTML.Tag</code>
-     * with a value that is an <code>AttributeSet</code> will also be checked.
+     * If {@code searchLeafAttributes} is true, and {@code e} is
+     * a leaf, any attributes that are instances of {@code HTML.Tag}
+     * with a value that is an {@code AttributeSet} will also be checked.
      *
      * @param e the root element where the search begins
-     * @param attribute the desired <code>Attribute</code>
-     * @param value the values for the specified <code>Attribute</code>
-     * @return the element with the specified <code>Attribute</code>
-     *          and the specified <code>value</code>, or <code>null</code>
+     * @param attribute the desired {@code Attribute}
+     * @param value the values for the specified {@code Attribute}
+     * @return the element with the specified {@code Attribute}
+     *          and the specified {@code value}, or {@code null}
      *          if it can't be found
      * @see javax.swing.text.html.HTML.Attribute
      */
     private Element getElement(Element e, Object attribute, Object value,
                                boolean searchLeafAttributes) {

@@ -1525,12 +1530,12 @@
         }
         return null;
     }
 
     /**
-     * Verifies the document has an <code>HTMLEditorKit.Parser</code> set.
-     * If <code>getParser</code> returns <code>null</code>, this will throw an
+     * Verifies the document has an {@code HTMLEditorKit.Parser} set.
+     * If {@code getParser} returns {@code null}, this will throw an
      * IllegalStateException.
      *
      * @throws IllegalStateException if the document does not have a Parser
      */
     private void verifyParser() {

@@ -1548,12 +1553,12 @@
         }
     }
 
     /**
      * Inserts a string of HTML into the document at the given position.
-     * <code>parent</code> is used to identify the location to insert the
-     * <code>html</code>. If <code>parent</code> is a leaf this can have
+     * {@code parent} is used to identify the location to insert the
+     * {@code html}. If {@code parent} is a leaf this can have
      * unexpected results.
      */
     private void insertHTML(Element parent, int offset, String html,
                             boolean wantsTrailingNewline)
                  throws BadLocationException, IOException {

@@ -1593,16 +1598,16 @@
             }
         }
     }
 
     /**
-     * Removes child Elements of the passed in Element <code>e</code>. This
+     * Removes child Elements of the passed in Element {@code e}. This
      * will do the necessary cleanup to ensure the element representing the
      * end character is correctly created.
-     * <p>This is not a general purpose method, it assumes that <code>e</code>
+     * <p>This is not a general purpose method, it assumes that {@code e}
      * will still have at least one child after the remove, and it assumes
-     * the character at <code>e.getStartOffset() - 1</code> is a newline and
+     * the character at {@code e.getStartOffset() - 1} is a newline and
      * is of length 1.
      */
     private void removeElements(Element e, int index, int count) throws BadLocationException {
         writeLock();
         try {

@@ -1618,18 +1623,18 @@
             writeUnlock();
         }
     }
 
     /**
-     * Called to remove child elements of <code>e</code> when one of the
+     * Called to remove child elements of {@code e} when one of the
      * elements to remove is representing the end character.
      * <p>Since the Content will not allow a removal to the end character
-     * this will do a remove from <code>start - 1</code> to <code>end</code>.
+     * this will do a remove from {@code start - 1} to {@code end}.
      * The end Element(s) will be removed, and the element representing
-     * <code>start - 1</code> to <code>start</code> will be recreated. This
+     * {@code start - 1} to {@code start} will be recreated. This
      * Element has to be recreated as after the content removal its offsets
-     * become <code>start - 1</code> to <code>start - 1</code>.
+     * become {@code start - 1} to {@code start - 1}.
      */
     private void removeElementsAtEnd(Element e, int index, int count,
                          int start, int end) throws BadLocationException {
         // index must be > 0 otherwise no insert would have happened.
         boolean isLeaf = (e.getElement(index - 1).isLeaf());

@@ -1671,15 +1676,15 @@
         fireRemoveUpdate(dde);
         fireUndoableEditUpdate(new UndoableEditEvent(this, dde));
     }
 
     /**
-     * This is used by <code>removeElementsAtEnd</code>, it removes
-     * <code>count</code> elements starting at <code>start</code> from
-     * <code>e</code>.  If <code>remove</code> is true text of length
-     * <code>start - 1</code> to <code>end - 1</code> is removed.  If
-     * <code>create</code> is true a new leaf is created of length 1.
+     * This is used by {@code removeElementsAtEnd}, it removes
+     * {@code count} elements starting at {@code start} from
+     * {@code e}.  If {@code remove} is true text of length
+     * {@code start - 1} to {@code end - 1} is removed.  If
+     * {@code create} is true a new leaf is created of length 1.
      */
     private void replace(DefaultDocumentEvent dde, Element e, int index,
                          int count, int start, int end, boolean remove,
                          boolean create) throws BadLocationException {
         Element[] added;

@@ -1887,12 +1892,12 @@
      */
     public abstract static class Iterator {
 
         /**
          * Return the attributes for this tag.
-         * @return the <code>AttributeSet</code> for this tag, or
-         *      <code>null</code> if none can be found
+         * @return the {@code AttributeSet} for this tag, or
+         *      {@code null} if none can be found
          */
         public abstract AttributeSet getAttributes();
 
         /**
          * Returns the start of the range for which the current occurrence of

@@ -1944,12 +1949,12 @@
             next();
         }
 
         /**
          * Returns the attributes for this tag.
-         * @return the <code>AttributeSet</code> for this tag,
-         *              or <code>null</code> if none can be found
+         * @return the {@code AttributeSet} for this tag,
+         *              or {@code null} if none can be found
          */
         public AttributeSet getAttributes() {
             Element elem = pos.current();
             if (elem != null) {
                 AttributeSet a = (AttributeSet)

@@ -2008,20 +2013,20 @@
         }
 
         /**
          * Returns the type of tag this iterator represents.
          *
-         * @return the <code>HTML.Tag</code> that this iterator represents.
+         * @return the {@code HTML.Tag} that this iterator represents.
          * @see javax.swing.text.html.HTML.Tag
          */
         public HTML.Tag getTag() {
             return tag;
         }
 
         /**
-         * Returns true if the current position is not <code>null</code>.
-         * @return true if current position is not <code>null</code>,
+         * Returns true if the current position is not {@code null}.
+         * @return true if current position is not {@code null},
          *              otherwise returns false
          */
         public boolean isValid() {
             return (pos.current() != null);
         }

@@ -2039,11 +2044,11 @@
             }
         }
 
         /**
          * Marches a cloned iterator forward to locate the end
-         * of the run.  This sets the value of <code>endOffset</code>.
+         * of the run.  This sets the value of {@code endOffset}.
          */
         void setEndOffset() {
             AttributeSet a0 = getAttributes();
             endOffset = pos.current().getEndOffset();
             ElementIterator fwd = (ElementIterator) pos.clone();

@@ -2072,11 +2077,11 @@
      * and burst it into the document under the protection of
      * a write lock using the insert method on the document
      * outer class.
      * <p>
      * The reader can be configured by registering actions
-     * (of type <code>HTMLDocument.HTMLReader.TagAction</code>)
+     * (of type {@code HTMLDocument.HTMLReader.TagAction})
      * that describe how to handle the action.  The idea behind
      * the actions provided is that the most natural text editing
      * operations can be provided if the element structure boils
      * down to paragraphs with runs of some kind of style
      * in them.  Some things are more naturally specified

@@ -2126,85 +2131,85 @@
      * Currently, &lt;APPLET&gt;, &lt;PARAM&gt;, &lt;MAP&gt;, &lt;AREA&gt;, &lt;LINK&gt;,
      * &lt;SCRIPT&gt; and &lt;STYLE&gt; are unsupported.
      *
      * <p>
      * The assignment of the actions described is shown in the
-     * following table for the tags defined in <code>HTML.Tag</code>.
+     * following table for the tags defined in {@code HTML.Tag}.
      * <table border=1 summary="HTML tags and assigned actions">
      * <tr><th>Tag</th><th>Action</th></tr>
-     * <tr><td><code>HTML.Tag.A</code>         <td>CharacterAction
-     * <tr><td><code>HTML.Tag.ADDRESS</code>   <td>CharacterAction
-     * <tr><td><code>HTML.Tag.APPLET</code>    <td>HiddenAction
-     * <tr><td><code>HTML.Tag.AREA</code>      <td>AreaAction
-     * <tr><td><code>HTML.Tag.B</code>         <td>CharacterAction
-     * <tr><td><code>HTML.Tag.BASE</code>      <td>BaseAction
-     * <tr><td><code>HTML.Tag.BASEFONT</code>  <td>CharacterAction
-     * <tr><td><code>HTML.Tag.BIG</code>       <td>CharacterAction
-     * <tr><td><code>HTML.Tag.BLOCKQUOTE</code><td>BlockAction
-     * <tr><td><code>HTML.Tag.BODY</code>      <td>BlockAction
-     * <tr><td><code>HTML.Tag.BR</code>        <td>SpecialAction
-     * <tr><td><code>HTML.Tag.CAPTION</code>   <td>BlockAction
-     * <tr><td><code>HTML.Tag.CENTER</code>    <td>BlockAction
-     * <tr><td><code>HTML.Tag.CITE</code>      <td>CharacterAction
-     * <tr><td><code>HTML.Tag.CODE</code>      <td>CharacterAction
-     * <tr><td><code>HTML.Tag.DD</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.DFN</code>       <td>CharacterAction
-     * <tr><td><code>HTML.Tag.DIR</code>       <td>BlockAction
-     * <tr><td><code>HTML.Tag.DIV</code>       <td>BlockAction
-     * <tr><td><code>HTML.Tag.DL</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.DT</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.EM</code>        <td>CharacterAction
-     * <tr><td><code>HTML.Tag.FONT</code>      <td>CharacterAction
-     * <tr><td><code>HTML.Tag.FORM</code>      <td>As of 1.4 a BlockAction
-     * <tr><td><code>HTML.Tag.FRAME</code>     <td>SpecialAction
-     * <tr><td><code>HTML.Tag.FRAMESET</code>  <td>BlockAction
-     * <tr><td><code>HTML.Tag.H1</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.H2</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.H3</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.H4</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.H5</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.H6</code>        <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.HEAD</code>      <td>HeadAction
-     * <tr><td><code>HTML.Tag.HR</code>        <td>SpecialAction
-     * <tr><td><code>HTML.Tag.HTML</code>      <td>BlockAction
-     * <tr><td><code>HTML.Tag.I</code>         <td>CharacterAction
-     * <tr><td><code>HTML.Tag.IMG</code>       <td>SpecialAction
-     * <tr><td><code>HTML.Tag.INPUT</code>     <td>FormAction
-     * <tr><td><code>HTML.Tag.ISINDEX</code>   <td>IsndexAction
-     * <tr><td><code>HTML.Tag.KBD</code>       <td>CharacterAction
-     * <tr><td><code>HTML.Tag.LI</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.LINK</code>      <td>LinkAction
-     * <tr><td><code>HTML.Tag.MAP</code>       <td>MapAction
-     * <tr><td><code>HTML.Tag.MENU</code>      <td>BlockAction
-     * <tr><td><code>HTML.Tag.META</code>      <td>MetaAction
-     * <tr><td><code>HTML.Tag.NOFRAMES</code>  <td>BlockAction
-     * <tr><td><code>HTML.Tag.OBJECT</code>    <td>SpecialAction
-     * <tr><td><code>HTML.Tag.OL</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.OPTION</code>    <td>FormAction
-     * <tr><td><code>HTML.Tag.P</code>         <td>ParagraphAction
-     * <tr><td><code>HTML.Tag.PARAM</code>     <td>HiddenAction
-     * <tr><td><code>HTML.Tag.PRE</code>       <td>PreAction
-     * <tr><td><code>HTML.Tag.SAMP</code>      <td>CharacterAction
-     * <tr><td><code>HTML.Tag.SCRIPT</code>    <td>HiddenAction
-     * <tr><td><code>HTML.Tag.SELECT</code>    <td>FormAction
-     * <tr><td><code>HTML.Tag.SMALL</code>     <td>CharacterAction
-     * <tr><td><code>HTML.Tag.STRIKE</code>    <td>CharacterAction
-     * <tr><td><code>HTML.Tag.S</code>         <td>CharacterAction
-     * <tr><td><code>HTML.Tag.STRONG</code>    <td>CharacterAction
-     * <tr><td><code>HTML.Tag.STYLE</code>     <td>StyleAction
-     * <tr><td><code>HTML.Tag.SUB</code>       <td>CharacterAction
-     * <tr><td><code>HTML.Tag.SUP</code>       <td>CharacterAction
-     * <tr><td><code>HTML.Tag.TABLE</code>     <td>BlockAction
-     * <tr><td><code>HTML.Tag.TD</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.TEXTAREA</code>  <td>FormAction
-     * <tr><td><code>HTML.Tag.TH</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.TITLE</code>     <td>TitleAction
-     * <tr><td><code>HTML.Tag.TR</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.TT</code>        <td>CharacterAction
-     * <tr><td><code>HTML.Tag.U</code>         <td>CharacterAction
-     * <tr><td><code>HTML.Tag.UL</code>        <td>BlockAction
-     * <tr><td><code>HTML.Tag.VAR</code>       <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.A}         <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.ADDRESS}   <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.APPLET}    <td>HiddenAction
+     * <tr><td>{@code HTML.Tag.AREA}      <td>AreaAction
+     * <tr><td>{@code HTML.Tag.B}         <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.BASE}      <td>BaseAction
+     * <tr><td>{@code HTML.Tag.BASEFONT}  <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.BIG}       <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.BLOCKQUOTE}<td>BlockAction
+     * <tr><td>{@code HTML.Tag.BODY}      <td>BlockAction
+     * <tr><td>{@code HTML.Tag.BR}        <td>SpecialAction
+     * <tr><td>{@code HTML.Tag.CAPTION}   <td>BlockAction
+     * <tr><td>{@code HTML.Tag.CENTER}    <td>BlockAction
+     * <tr><td>{@code HTML.Tag.CITE}      <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.CODE}      <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.DD}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.DFN}       <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.DIR}       <td>BlockAction
+     * <tr><td>{@code HTML.Tag.DIV}       <td>BlockAction
+     * <tr><td>{@code HTML.Tag.DL}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.DT}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.EM}        <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.FONT}      <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.FORM}      <td>As of 1.4 a BlockAction
+     * <tr><td>{@code HTML.Tag.FRAME}     <td>SpecialAction
+     * <tr><td>{@code HTML.Tag.FRAMESET}  <td>BlockAction
+     * <tr><td>{@code HTML.Tag.H1}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.H2}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.H3}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.H4}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.H5}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.H6}        <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.HEAD}      <td>HeadAction
+     * <tr><td>{@code HTML.Tag.HR}        <td>SpecialAction
+     * <tr><td>{@code HTML.Tag.HTML}      <td>BlockAction
+     * <tr><td>{@code HTML.Tag.I}         <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.IMG}       <td>SpecialAction
+     * <tr><td>{@code HTML.Tag.INPUT}     <td>FormAction
+     * <tr><td>{@code HTML.Tag.ISINDEX}   <td>IsndexAction
+     * <tr><td>{@code HTML.Tag.KBD}       <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.LI}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.LINK}      <td>LinkAction
+     * <tr><td>{@code HTML.Tag.MAP}       <td>MapAction
+     * <tr><td>{@code HTML.Tag.MENU}      <td>BlockAction
+     * <tr><td>{@code HTML.Tag.META}      <td>MetaAction
+     * <tr><td>{@code HTML.Tag.NOFRAMES}  <td>BlockAction
+     * <tr><td>{@code HTML.Tag.OBJECT}    <td>SpecialAction
+     * <tr><td>{@code HTML.Tag.OL}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.OPTION}    <td>FormAction
+     * <tr><td>{@code HTML.Tag.P}         <td>ParagraphAction
+     * <tr><td>{@code HTML.Tag.PARAM}     <td>HiddenAction
+     * <tr><td>{@code HTML.Tag.PRE}       <td>PreAction
+     * <tr><td>{@code HTML.Tag.SAMP}      <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.SCRIPT}    <td>HiddenAction
+     * <tr><td>{@code HTML.Tag.SELECT}    <td>FormAction
+     * <tr><td>{@code HTML.Tag.SMALL}     <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.STRIKE}    <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.S}         <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.STRONG}    <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.STYLE}     <td>StyleAction
+     * <tr><td>{@code HTML.Tag.SUB}       <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.SUP}       <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.TABLE}     <td>BlockAction
+     * <tr><td>{@code HTML.Tag.TD}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.TEXTAREA}  <td>FormAction
+     * <tr><td>{@code HTML.Tag.TH}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.TITLE}     <td>TitleAction
+     * <tr><td>{@code HTML.Tag.TR}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.TT}        <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.U}         <td>CharacterAction
+     * <tr><td>{@code HTML.Tag.UL}        <td>BlockAction
+     * <tr><td>{@code HTML.Tag.VAR}       <td>CharacterAction
      * </table>
      * <p>
      * Once &lt;/html&gt; is encountered, the Actions are no longer notified.
      */
     public class HTMLReader extends HTMLEditorKit.ParserCallback {

@@ -2233,12 +2238,12 @@
         }
 
         /**
          * Generates a RuntimeException (will eventually generate
          * a BadLocationException when API changes are alloced) if inserting
-         * into non empty document, <code>insertTag</code> is
-         * non-<code>null</code>, and <code>offset</code> is not in the body.
+         * into non empty document, {@code insertTag} is
+         * non-{@code null}, and {@code offset} is not in the body.
          */
         // PENDING(sky): Add throws BadLocationException and remove
         // RuntimeException
         HTMLReader(int offset, int popDepth, int pushDepth,
                    HTML.Tag insertTag, boolean insertInsertTag,

@@ -2358,12 +2363,12 @@
                     generateEndsSpecsForMidInsert();
                 }
             }
 
             /**
-             * This block initializes the <code>inParagraph</code> flag.
-             * It is left in <code>false</code> value automatically
+             * This block initializes the {@code inParagraph} flag.
+             * It is left in {@code false} value automatically
              * if the target document is empty or future inserts
              * were positioned into the 'body' tag.
              */
             if (!emptyDocument && !midInsert) {
                 int targetOffset = Math.max(this.offset - 1, 0);

@@ -2388,11 +2393,11 @@
                 }
             }
         }
 
         /**
-         * Generates an initial batch of end <code>ElementSpecs</code>
+         * Generates an initial batch of end {@code ElementSpecs}
          * in parseBuffer to position future inserts into the body.
          */
         private void generateEndsSpecsForMidInsert() {
             int           count = heightToElementWithName(HTML.Tag.BODY,
                                                    Math.max(0, offset - 1));

@@ -2453,14 +2458,14 @@
             }
             return count;
         }
 
         /**
-         * @return number of parents of the leaf at <code>offset</code>
-         *         until a parent with name, <code>name</code> has been
+         * @return number of parents of the leaf at {@code offset}
+         *         until a parent with name, {@code name} has been
          *         found. -1 indicates no matching parent with
-         *         <code>name</code>.
+         *         {@code name}.
          */
         private int heightToElementWithName(Object name, int offset) {
             Element       e = getCharacterElement(offset).getParentElement();
             int           count = 0;
 

@@ -2702,11 +2707,11 @@
                 action.end(HTML.Tag.COMMENT);
             }
         }
 
         /**
-         * Adds the comment <code>comment</code> to the set of comments
+         * Adds the comment {@code comment} to the set of comments
          * maintained outside of the scope of elements.
          */
         private void addExternalComment(String comment) {
             Object comments = getProperty(AdditionalComments);
             if (comments != null && !(comments instanceof Vector)) {

@@ -2776,11 +2781,11 @@
             }
         }
 
         /**
          * This is invoked after the stream has been parsed, but before
-         * <code>flush</code>. <code>eol</code> will be one of \n, \r
+         * {@code flush}. {@code eol} will be one of \n, \r
          * or \r\n, which ever is encountered the most in parsing the
          * stream.
          *
          * @since 1.3
          */

@@ -3377,11 +3382,11 @@
          * Action to support forms by building all of the elements
          * used to represent form controls.  This will process
          * the &lt;INPUT&gt;, &lt;TEXTAREA&gt;, &lt;SELECT&gt;,
          * and &lt;OPTION&gt; tags.  The element created by
          * this action is expected to have the attribute
-         * <code>StyleConstants.ModelAttribute</code> set to
+         * {@code StyleConstants.ModelAttribute} set to
          * the model that holds the state for the form control.
          * This enables multiple views, and allows document to
          * be iterated over picking up the data of the form.
          * The following are the model assignments for the
          * various type of form elements.

@@ -3565,11 +3570,11 @@
 
             /**
              * If a &lt;SELECT&gt; tag is being processed, this
              * model will be a reference to the model being filled
              * with the &lt;OPTION&gt; elements (which produce
-             * objects of type <code>Option</code>.
+             * objects of type {@code Option}.
              */
             Object selectModel;
             int optionCount;
         }
 

@@ -3824,11 +3829,11 @@
             offset += HTMLDocument.this.getLength() - oldLength;
             flushCount++;
         }
 
         /**
-         * This will be invoked for the last flush, if <code>insertTag</code>
+         * This will be invoked for the last flush, if {@code insertTag}
          * is non null.
          */
         private void adjustEndSpecsForPartialInsert() {
             int size = parseBuffer.size();
             if (insertTagDepthDelta < 0) {

@@ -3902,19 +3907,19 @@
                 }
             }
         }
 
         /**
-         * Adds the CSS rules in <code>rules</code>.
+         * Adds the CSS rules in {@code rules}.
          */
         void addCSSRules(String rules) {
             StyleSheet ss = getStyleSheet();
             ss.addRule(rules);
         }
 
         /**
-         * Adds the CSS stylesheet at <code>href</code> to the known list
+         * Adds the CSS stylesheet at {@code href} to the known list
          * of stylesheets.
          */
         void linkCSSStyleSheet(String href) {
             URL url;
             try {

@@ -3930,11 +3935,11 @@
                 getStyleSheet().importStyleSheet(url);
             }
         }
 
         /**
-         * Returns true if can insert starting at <code>t</code>. This
+         * Returns true if can insert starting at {@code t}. This
          * will return false if the insert tag is set, and hasn't been found
          * yet.
          */
         private boolean canInsertTag(HTML.Tag t, AttributeSet attr,
                                      boolean isBlockTag) {

@@ -4068,11 +4073,11 @@
 
         /**
          * This is set to true when and end is invoked for {@literal <html>}.
          */
         private boolean receivedEndHTML;
-        /** Number of times <code>flushBuffer</code> has been invoked. */
+        /** Number of times {@code flushBuffer} has been invoked. */
         private int flushCount;
         /** If true, behavior is similar to insertTag, but instead of
          * waiting for insertTag will wait for first Element without
          * an 'implied' attribute and begin inserting then. */
         private boolean insertAfterImplied;
< prev index next >