jdk/src/share/classes/javax/swing/text/html/parser/Parser.java
changeset 21278 ef8a3a2a72f2
parent 20169 d7fa6d7586c9
child 23262 41f2413bba45
equal deleted inserted replaced
21277:bd380b80f9ea 21278:ef8a3a2a72f2
   545         boolean insertTag = false;
   545         boolean insertTag = false;
   546 
   546 
   547         // The use of all error recovery strategies are contingent
   547         // The use of all error recovery strategies are contingent
   548         // on the value of the strict property.
   548         // on the value of the strict property.
   549         //
   549         //
   550         // These are commonly occuring errors.  if insertTag is true,
   550         // These are commonly occurring errors.  if insertTag is true,
   551         // then we want to adopt an error recovery strategy that
   551         // then we want to adopt an error recovery strategy that
   552         // involves attempting to insert an additional tag to
   552         // involves attempting to insert an additional tag to
   553         // legalize the context.  The two errors addressed here
   553         // legalize the context.  The two errors addressed here
   554         // are:
   554         // are:
   555         // 1) when a <td> or <th> is seen soon after a <table> tag.
   555         // 1) when a <td> or <th> is seen soon after a <table> tag.
   604         }
   604         }
   605 
   605 
   606         // They try to find a legal context by checking if the current
   606         // They try to find a legal context by checking if the current
   607         // tag is valid in an enclosing context.  If so
   607         // tag is valid in an enclosing context.  If so
   608         // close out the tags by outputing end tags and then
   608         // close out the tags by outputing end tags and then
   609         // insert the curent tag.  If the tags that are
   609         // insert the current tag.  If the tags that are
   610         // being closed out do not have an optional end tag
   610         // being closed out do not have an optional end tag
   611         // specification in the DTD then an html error is
   611         // specification in the DTD then an html error is
   612         // reported.
   612         // reported.
   613         //
   613         //
   614         if (!insertTag && stack.terminate() && (!strict || stack.elem.omitEnd())) {
   614         if (!insertTag && stack.terminate() && (!strict || stack.elem.omitEnd())) {
  1759                 return;
  1759                 return;
  1760             }
  1760             }
  1761 
  1761 
  1762             // find the corresponding start tag
  1762             // find the corresponding start tag
  1763 
  1763 
  1764             // A commonly occuring error appears to be the insertion
  1764             // A commonly occurring error appears to be the insertion
  1765             // of extra end tags in a table.  The intent here is ignore
  1765             // of extra end tags in a table.  The intent here is ignore
  1766             // such extra end tags.
  1766             // such extra end tags.
  1767             //
  1767             //
  1768             if (!strict) {
  1768             if (!strict) {
  1769                 String stackElem = stack.elem.getName();
  1769                 String stackElem = stack.elem.getName();
  1770 
  1770 
  1771                 if (stackElem.equals("table")) {
  1771                 if (stackElem.equals("table")) {
  1772                     // If it isnt a valid end tag ignore it and return
  1772                     // If it is not a valid end tag ignore it and return
  1773                     //
  1773                     //
  1774                     if (!elem.getName().equals(stackElem)) {
  1774                     if (!elem.getName().equals(stackElem)) {
  1775                         error("tag.ignore", elem.getName());
  1775                         error("tag.ignore", elem.getName());
  1776                         return;
  1776                         return;
  1777                     }
  1777                     }