Not just a plain text, but many other related tags must be enclosed into paragraphs if they appear at the body level.

2006-07-16  Audrius Meskauskas  <[EMAIL PROTECTED]>

   PR 28392
* gnu/javax/swing/text/html/parser/htmlValidator.java (tagIsValidForContext):
   If it is not possible to insert any tag, but is possible to insert a P,
   insert a P.
   * gnu/javax/swing/text/html/parser/HTML_401Swing.java
   (newInstance): Removed print statement. (getBodyElements):
   Removed ABBR, ACRONYM, BDO, Q, S, SUB, SUP and ADDRESS from the
   valid body tags.

### Eclipse Workspace Patch 1.0
#P classpath
Index: gnu/javax/swing/text/html/parser/htmlValidator.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/javax/swing/text/html/parser/htmlValidator.java,v
retrieving revision 1.4
diff -u -r1.4 htmlValidator.java
--- gnu/javax/swing/text/html/parser/htmlValidator.java	16 Jul 2006 15:03:08 -0000	1.4
+++ gnu/javax/swing/text/html/parser/htmlValidator.java	16 Jul 2006 18:13:32 -0000
@@ -303,13 +303,12 @@
   }
 
   /**
-   * Check if this tag is valid for the current context.
-   * Return Boolean.True if it is OK, Boolean.False
-   * if it is surely not OK or the Element that the
-   * content model recommends to insert making the situation
-   * ok. If Boolean.True is returned, the content model current
-   * position is moved forward. Otherwise this position remains
-   * the same.
+   * Check if this tag is valid for the current context. Return Boolean.True if
+   * it is OK, Boolean.False if it is surely not OK or the Element that the
+   * content model recommends to insert making the situation ok. If Boolean.True
+   * is returned, the content model current position is moved forward. Otherwise
+   * this position remains the same.
+   * 
    * @param tElement
    * @return
    */
@@ -333,30 +332,26 @@
         while (iter.hasPrevious())
           {
             t = (hTag) iter.previous();
-            if (!t.forcibly_closed)
+            if (! t.forcibly_closed)
               {
-                if (t.element.exclusions != null &&
-                    t.element.exclusions.get(idx)
-                   )
+                if (t.element.exclusions != null
+                    && t.element.exclusions.get(idx))
                   return Boolean.FALSE;
 
                 if (t.element.inclusions != null)
                   inclusions.or(t.element.inclusions);
               }
           }
-        if (!inclusions.get(idx))
+        if (! inclusions.get(idx))
           {
-            // If we need to insert the text, and cannot do this, but
-            // it is allowed to insert the paragraph here, insert the 
+            // If we need to insert something, and cannot do this, but
+            // it is allowed to insert the paragraph here, insert the
             // paragraph.
-            if (tElement.getElement().getName().
-                equalsIgnoreCase(HTML_401F.PCDATA))
-              {
-                Element P = dtd.getElement(HTML_401F.P); 
-                if (inclusions.get(P.index))
-                  return P;
-              }
-            return Boolean.FALSE;
+            Element P = dtd.getElement(HTML_401F.P);
+            if (inclusions.get(P.index))
+              return P;
+            else
+              return Boolean.FALSE;
           }
       }
     return Boolean.TRUE;
Index: gnu/javax/swing/text/html/parser/HTML_401Swing.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/javax/swing/text/html/parser/HTML_401Swing.java,v
retrieving revision 1.1
diff -u -r1.1 HTML_401Swing.java
--- gnu/javax/swing/text/html/parser/HTML_401Swing.java	16 Jul 2006 15:03:08 -0000	1.1
+++ gnu/javax/swing/text/html/parser/HTML_401Swing.java	16 Jul 2006 18:13:32 -0000
@@ -38,9 +38,6 @@
 
 package gnu.javax.swing.text.html.parser;
 
-import java.io.IOException;
-
-import javax.swing.text.html.parser.ContentModel;
 import javax.swing.text.html.parser.DTD;
 
 /**
@@ -64,7 +61,6 @@
    */
   public static DTD getInstance()
   {
-    System.out.println("HTML_401Swing.java.getInstance:");
     return singleton;
   }  
   
@@ -78,15 +74,13 @@
   protected String[] getBodyElements()
   {
     return new String[] {
-        ABBR, ACRONYM,
-        APPLET, BASEFONT, BDO, 
+        APPLET, BASEFONT,
         BR, BUTTON, 
-        FONT, IFRAME, IMG,
+        IFRAME, IMG,
         INPUT, LABEL, MAP, OBJECT,
-        Q, S, SCRIPT, SELECT,
-        SPAN, STRIKE, SUB,
-        SUP, TEXTAREA, 
-        ADDRESS, BLOCKQUOTE, CENTER, DEL, DIR,
+        SCRIPT, SELECT,
+        TEXTAREA, 
+        BLOCKQUOTE, CENTER, DEL, DIR,
         DIV, DL, FIELDSET, FORM, H1,
         H2, H3, H4, H5, H6,
         HR, INS, ISINDEX, MENU, NOFRAMES,
@@ -94,5 +88,4 @@
         UL
       };
   }
-
 }

Reply via email to