small fixes here and there
[mir.git] / source / mir / util / xml / html / HTMLParser.java
index d810ab1..669a9bd 100755 (executable)
@@ -47,6 +47,15 @@ public class HTMLParser {
       HTMLSchemaInformation.HTMLTagInformation tagInformation =
           schemaInformation.lookupTag(lowercaseTag);
 
+      Map attributes = new HashMap();
+
+      Iterator i = anAttributes.entrySet().iterator();
+      while (i.hasNext()) {
+        Map.Entry entry = (Map.Entry) i.next();
+
+        attributes.put(((String) entry.getKey()).toLowerCase(), entry.getValue());
+      }
+
       if (tagInformation!=null) {
         if (tagInformation.getIsBlock()) {
           closeAllInlineTags();
@@ -54,15 +63,6 @@ public class HTMLParser {
 
         closeAllAutoclosingTags(tagInformation);
 
-        Map attributes = new HashMap();
-
-        Iterator i = anAttributes.entrySet().iterator();
-        while (i.hasNext()) {
-          Map.Entry entry = (Map.Entry) i.next();
-
-          attributes.put(((String) entry.getKey()).toLowerCase(), entry.getValue());
-        }
-
         receiver.openTag(lowercaseTag, attributes);
         if (tagInformation.getHasBody()) {
           tagStack.push(lowercaseTag);
@@ -72,25 +72,24 @@ public class HTMLParser {
         }
       }
       else {
-        tagStack.push(aTag);
+        receiver.openTag(lowercaseTag, attributes);
+        tagStack.push(lowercaseTag);
       }
     }
 
     public void handleClosingTag(String aTag) throws HTMLParserExc {
       String lowercaseTag = aTag.toLowerCase();
-      String tag = aTag;
 
       HTMLSchemaInformation.HTMLTagInformation tagInformation =
           schemaInformation.lookupTag(lowercaseTag);
 
       if (tagInformation!=null) {
-        tag = lowercaseTag;
         if (tagInformation.getIsBlock()) {
           closeAllInlineTags();
         }
       }
 
-      int index = tagStack.search(tag);
+      int index = tagStack.search(lowercaseTag);
 
       if (index>-1 && index<4) {
         for (int i=0; i<index; i++) {