当前位置: 首页>>代码示例>>Java>>正文


Java TagElement.getHTMLTag方法代码示例

本文整理汇总了Java中javax.swing.text.html.parser.TagElement.getHTMLTag方法的典型用法代码示例。如果您正苦于以下问题:Java TagElement.getHTMLTag方法的具体用法?Java TagElement.getHTMLTag怎么用?Java TagElement.getHTMLTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.html.parser.TagElement的用法示例。


在下文中一共展示了TagElement.getHTMLTag方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _handleCompleteElement

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
/**
 * Handle a complete element, when the tag content is already present in the
 * buffer and both starting and heading tags behind. This is called
 * in the case when the tag text must not be parsed for the nested
 * elements (elements STYLE and SCRIPT).
 */
private void _handleCompleteElement(TagElement tag)
{
  _handleStartTag(tag);

  // Suppress inclusion of the SCRIPT ans STYLE texts into the title.
  HTML.Tag h = tag.getHTMLTag();
  if (h == HTML.Tag.SCRIPT || h == HTML.Tag.STYLE)
    {
      boolean tmp = titleOpen;
      titleOpen = false;
      _handleText();
      titleOpen = tmp;
    }
  else
    _handleText();

  _handleEndTag(tag);
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:Parser.java

示例2: _handleEmptyTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
/**
 * A hooks for operations, preceeding call to handleEmptyTag().
 * Handle the tag with no content, like <br>. As no any
 * nested tags are expected, the tag validator is not involved.
 * @param tag The tag being handled.
 */
private void _handleEmptyTag(TagElement tag)
{
  try
    {
      validator.validateTag(tag, attributes);
      handleEmptyTag(tag);
      HTML.Tag h = tag.getHTMLTag();
      // When a block tag is closed, consume whitespace that follows after
      // it.
      // For some unknown reason a FRAME tag is not treated as block element.
      // However in this case it should be treated as such.
      if (isBlock(h))
        optional(WS);
    }
  catch (ChangedCharSetException ex)
    {
      error("Changed charset exception:", ex.getMessage());
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:Parser.java

示例3: _handleStartTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
/**
 * A hooks for operations, preceeding call to handleStartTag().
 * The method is called when the HTML opening tag ((like <table>)
 * is found.
 * Package-private to avoid an accessor method.
 * @param tag The tag
 */
void _handleStartTag(TagElement tag)
{
  validator.openTag(tag, attributes);
  startingTag(tag);
  handleStartTag(tag);

  HTML.Tag h = tag.getHTMLTag();

  if (isBlock(h))
    optional(WS);

  if (h.isPreformatted())
    preformatted++;

  if (h == HTML.Tag.TITLE)
    {
      if (titleHandled)
        error("Repetetive <TITLE> tag");
      titleOpen = true;
      titleHandled = false;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:30,代码来源:Parser.java

示例4: _handleEndTag_remaining

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
/**
 * Actions that are also required if the closing action was
 * initiated by the tag validator.
 * Package-private to avoid an accessor method.
 */
void _handleEndTag_remaining(TagElement tag)
{
  HTML.Tag h = tag.getHTMLTag();

  handleEndTag(tag);
  endTag(tag.fictional());

  if (h.isPreformatted())
    preformatted--;
  if (preformatted < 0)
    preformatted = 0;

  // When a block tag is closed, consume whitespace that follows after
  // it.
  if (isBlock(h))
    optional(WS);

  if (h == HTML.Tag.TITLE)
    {
      titleOpen = false;
      titleHandled = true;

      char[] a = new char[ title.length() ];
      title.getChars(0, a.length, a, 0);
      handleTitle(a);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:33,代码来源:Parser.java

示例5: handleStartTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
/**
 * Handle the start tag by inserting the HTML element.
 * @param tag the tag to handle.
 */
protected void handleStartTag(TagElement tag)
{
  HTML.Tag h = tag.getHTMLTag();
  Node c = createNode(h.toString());
  cursor.appendChild(c);
  cursor = c;
}
 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:DomHTMLParser.java

示例6: handleStartTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
@Override
protected void handleStartTag(TagElement tag) {
    if (tag == null)
        return;

    HTML.Tag htmlTag = tag.getHTMLTag();

    if (htmlTag == HTML.Tag.APPLET || htmlTag == HTML.Tag.OBJECT) {

        if (startElement != null) {
            throw new RuntimeException(htmlTag+" inside "+startElement);
        }
        
        startElement = htmlTag;
        appletInfo = new AppletInfo();
        appletInfo.setTag(htmlTag.toString());
        list.add(appletInfo);

        appletInfo.setDocumentBase(documentBase);
       
        SimpleAttributeSet attributes = getAttributes();

        appletInfo.setParameter("WIDTH", (String)attributes.getAttribute(HTML.Attribute.WIDTH)); 
        appletInfo.setParameter("HEIGHT", (String)attributes.getAttribute(HTML.Attribute.HEIGHT));
        appletInfo.setParameter("CODE", (String)attributes.getAttribute(HTML.Attribute.CODE));
        appletInfo.setParameter("ARCHIVE", (String)attributes.getAttribute(HTML.Attribute.ARCHIVE));

        if (htmlTag != HTML.Tag.OBJECT) {
            appletInfo.setParameter("CODEBASE", (String)attributes.getAttribute(HTML.Attribute.CODEBASE));
        }

    }           
}
 
开发者ID:shannah,项目名称:cn1,代码行数:34,代码来源:HTMLParser.java

示例7: handleEmptyTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
@Override
protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException {

    HTML.Tag htmlTag = tag.getHTMLTag();
    if (appletInfo != null && htmlTag == HTML.Tag.PARAM) {
        SimpleAttributeSet attributes = getAttributes();
        appletInfo.setParameter((String)attributes.getAttribute(HTML.Attribute.NAME), 
            (String)attributes.getAttribute(HTML.Attribute.VALUE));
    }

}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:HTMLParser.java

示例8: startTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
@Override
protected void startTag(TagElement tag) throws ChangedCharSetException {
    super.startTag(tag);

    final HTML.Tag htmlTag = tag.getHTMLTag();
    if (htmlTag != null) {
        if (HTML.Tag.A.equals(htmlTag)) {
            final SimpleAttributeSet attributes = getAttributes();
            final Object name = attributes.getAttribute(HTML.Attribute.NAME);
            if (name != null) {
                final String nameAttr = (String) name;
                if (parserState == ParserState.INIT
                    && ("method_summary".equals(nameAttr) || "method.summary".equals(nameAttr))) {
                    parserState = ParserState.METHOD_SUMMARY;
                } else if (parserState == ParserState.METHOD) {
                    if (methodWithTypes == null) {

                        final String hrefAttr = (String) attributes.getAttribute(HTML.Attribute.HREF);
                        if (hrefAttr != null && hrefAttr.contains(hrefPattern)) {
                            // unescape HTML
                            String methodSignature = hrefAttr.substring(hrefAttr.indexOf('#') + 1);
                            final int firstHyphen = methodSignature.indexOf('-');
                            if (firstHyphen != -1) {
                                final int lastHyphen = methodSignature.lastIndexOf('-');
                                methodSignature = methodSignature.substring(0, firstHyphen) + "("
                                    + methodSignature.substring(firstHyphen + 1, lastHyphen) + ")";
                                methodSignature = methodSignature.replaceAll("-", ",");
                            }
                            // support varargs
                            if (methodSignature.contains("...)")) {
                                methodSignature = methodSignature.replaceAll("\\.\\.\\.\\)", "[])");
                            }
                            // map Java8 array types
                            if (methodSignature.contains(":A")) {
                                methodSignature = methodSignature.replaceAll(":A", "[]");
                            }
                            methodWithTypes = unescapeHtml(methodSignature);
                        }
                    } else {
                        final String title = (String) attributes.getAttribute(HTML.Attribute.TITLE);
                        if (title != null) {
                            // append package name to type name text
                            methodTextBuilder.append(title.substring(title.lastIndexOf(' '))).append('.');
                        }
                    }
                }
            }
        } else if (parserState == ParserState.METHOD_SUMMARY && HTML.Tag.CODE.equals(htmlTag)) {
            parserState = ParserState.METHOD;
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:53,代码来源:JavadocParser.java

示例9: handleEndTag

import javax.swing.text.html.parser.TagElement; //导入方法依赖的package包/类
@Override
protected void handleEndTag(TagElement tag) {
    if (tag != null && tag.getHTMLTag() == startElement)
        startElement = null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:6,代码来源:HTMLParser.java


注:本文中的javax.swing.text.html.parser.TagElement.getHTMLTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。