private void parseNamespaces() {
   Attributes attributes = tag.getAttributes();
   if (attributes != null) {
     for (Attribute attribute : tag.getAttributes()) {
       String name = attribute.getName();
       if (name.toLowerCase().startsWith("xmlns")) {
         int colon = name.indexOf(":", 5);
         String prefix;
         if (colon == 0) {
           prefix = "";
         } else {
           prefix = name.substring(colon);
         }
         namespaces.put(prefix, attribute.getValue());
       }
     }
   }
 }
 @Override
 public String getHTML() {
   if (tmpTpl != null) {
     String tt = tmpTpl;
     tmpTpl = null;
     return tt;
   }
   try {
     String html = this.getCompiler().compile(getTemplate(), getContext());
     if (forceStyle) {
       Source source = new Source(html);
       Attributes attrs = source.getFirstElement().getAttributes();
       if (attrs != null) {
         // id
         // class
         // style
         // name
         for (int i = 0; i < attrs.size(); i++) {
           Attribute attr = attrs.get(i);
           String name = attr.getName();
           String value = attr.getValue();
           // System.out.println(name  + ":" + value);
           if (name.equals("id")) {
             this.id = attr.getValue();
           } else {
             setAttribute(name, value);
           }
         }
       }
       html = JavascriptUtil.javaScriptEscape(html);
       tmpTpl = html;
     } else {
       html = JavascriptUtil.javaScriptEscape(html);
     }
     return html;
   } catch (Exception e) {
     e.printStackTrace();
     return "<h1>There was an error<h1><p>"
         + JavascriptUtil.javaScriptEscape(e.getMessage())
         + "</p>";
     // throw new IllegalStateException(e);
   }
 }
 private void processAttribute(Attribute attribute) {
   writer.write(" ");
   writer.write(attribute.getName());
   if (attribute.hasValue()) {
     String inputValue = attribute.getValue();
     String outputValue = inputValue;
     try {
       Level tag = stack.peek();
       outputValue =
           filterAttribute(tag.getQName(), tag.getQName(attribute.getName()), inputValue, null);
       if (outputValue == null) {
         outputValue = inputValue;
       }
     } catch (Exception e) {
       LOG.failedToFilterAttribute(attribute.getName(), e);
     }
     writer.write("=");
     writer.write(attribute.getQuoteChar());
     writer.write(outputValue);
     writer.write(attribute.getQuoteChar());
   }
 }