/**
   * Searches for embedded tags in the AttributeSet and writes them out. It also stores these tags
   * in a vector so that when appropriate the corresponding end tags can be written out.
   *
   * @exception IOException on any I/O error
   */
  protected void writeEmbeddedTags(AttributeSet attr) throws IOException {

    // translate css attributes to html
    attr = convertToHTML(attr, oConvAttr);

    Enumeration names = attr.getAttributeNames();
    while (names.hasMoreElements()) {
      Object name = names.nextElement();
      if (name instanceof HTML.Tag) {
        HTML.Tag tag = (HTML.Tag) name;
        if (tag == HTML.Tag.FORM || tags.contains(tag)) {
          continue;
        }
        write('<');
        write(tag.toString());
        Object o = attr.getAttribute(tag);
        if (o != null && o instanceof AttributeSet) {
          writeAttributes((AttributeSet) o);
        }
        write('>');
        tags.addElement(tag);
        tagValues.addElement(o);
      }
    }
  }
 /**
  * Determines if the HTML.Tag associated with the element is a block tag.
  *
  * @param attr an AttributeSet
  * @return true if tag is block tag, false otherwise.
  */
 protected boolean isBlockTag(AttributeSet attr) {
   Object o = attr.getAttribute(StyleConstants.NameAttribute);
   if (o instanceof HTML.Tag) {
     HTML.Tag name = (HTML.Tag) o;
     return name.isBlock();
   }
   return false;
 }
 /**
  * Creates a {@link View} for the specified <code>Element</code>.
  *
  * @param element the <code>Element</code> to create a <code>View</code> for
  * @return the <code>View</code> for the specified <code>Element</code> or <code>null</code> if
  *     the type of <code>element</code> is not supported
  */
 public View create(Element element) {
   View view = null;
   Object attr = element.getAttributes().getAttribute(StyleConstants.NameAttribute);
   if (attr instanceof HTML.Tag) {
     HTML.Tag tag = (HTML.Tag) attr;
     if (tag.equals(HTML.Tag.IMPLIED) || tag.equals(HTML.Tag.P)) {
       view = new MinParagraphView(element);
     } else if (tag.equals(HTML.Tag.OBJECT)) {
       view = new ConstObjectView(element, map);
     }
   }
   return (view != null ? view : super.create(element));
 }
  /**
   * Searches the attribute set and for each tag that is stored in the tag vector. If the tag isnt
   * found, then the tag is removed from the vector and a corresponding end tag is written out.
   *
   * @exception IOException on any I/O error
   */
  protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException {

    tagsToRemove.removeAllElements();

    // translate css attributes to html
    attr = convertToHTML(attr, null);

    HTML.Tag t;
    Object tValue;
    int firstIndex = -1;
    int size = tags.size();
    // First, find all the tags that need to be removed.
    for (int i = size - 1; i >= 0; i--) {
      t = (HTML.Tag) tags.elementAt(i);
      tValue = tagValues.elementAt(i);
      if ((attr == null) || noMatchForTagInAttributes(attr, t, tValue)) {
        firstIndex = i;
        tagsToRemove.addElement(t);
      }
    }
    if (firstIndex != -1) {
      // Then close them out.
      boolean removeAll = ((size - firstIndex) == tagsToRemove.size());
      for (int i = size - 1; i >= firstIndex; i--) {
        t = (HTML.Tag) tags.elementAt(i);
        if (removeAll || tagsToRemove.contains(t)) {
          tags.removeElementAt(i);
          tagValues.removeElementAt(i);
        }
        write('<');
        write('/');
        write(t.toString());
        write('>');
      }
      // Have to output any tags after firstIndex that still remaing,
      // as we closed them out, but they should remain open.
      size = tags.size();
      for (int i = firstIndex; i < size; i++) {
        t = (HTML.Tag) tags.elementAt(i);
        write('<');
        write(t.toString());
        Object o = tagValues.elementAt(i);
        if (o != null && o instanceof AttributeSet) {
          writeAttributes((AttributeSet) o);
        }
        write('>');
      }
    }
  }
 @Override
 public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, int pos) {
   // <B>が出たら次の地の文はカテゴリ名。なのでフラグを立てる。
   if (tag.equals(HTML.Tag.B)) {
     start_bold = true;
     start_category_flag = true;
   }
   // <A>タグが出たらurlを保持。あとで板名とペアにする。
   if (tag.equals(HTML.Tag.A)) {
     // 頭についてる広告タグは無視。
     if (parse_2ch_start_flag) {
       String href = (String) attr.getAttribute(HTML.Attribute.HREF);
       next_board_url = href;
     }
   }
 }
 // </B>タグ。次の地の文はカテゴリじゃないのでフラグを倒す。
 @Override
 public void handleEndTag(HTML.Tag tag, int pos) {
   if (tag.equals(HTML.Tag.B)) {
     start_bold = false;
   }
 }