• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TagElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



TagElement类属于javax.swing.text.html.parser包,在下文中一共展示了TagElement类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: _handleText

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
/**
 * A hook, for operations, preceeding call to handleText.
 * Handle text in a string buffer.
 * In non - preformatted mode, all line breaks immediately following the
 * start tag and immediately before an end tag is discarded,
 * \r, \n and \t are replaced by spaces, multiple space are replaced
 * by the single one and the result is  moved into array,
 * passing it  to handleText().
 */
protected void _handleText()
{
  char[] text;

  if (preformatted > 0)
    text = textProcessor.preprocessPreformatted(buffer);
  else
    text = textProcessor.preprocess(buffer);

  if (text != null && text.length > 0
      // According to the specs we need to discard whitespace immediately
      // before a closing tag.
      && (text.length > 1 || text[0] != ' ' || ! TAG_CLOSE.matches(this)))
    {
      TagElement pcdata = new TagElement(dtd.getElement("#pcdata"));
      attributes = htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET;
      _handleEmptyTag(pcdata);

      handleText(text);
      if (titleOpen)
        title.append(text);
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:33,代码来源:Parser.java


示例2: _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


示例3: _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


示例4: _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


示例5: makeTagElement

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
private TagElement makeTagElement(String name, boolean isSupposed)
{
  Element e = dtd.elementHash.get(name.toLowerCase());
  if (e == null)
    {
      error("Unknown tag <" + name + ">");
      e = dtd.getElement(name);
      e.name = name.toUpperCase();
      e.index = -1;
    }

  if (!documentTags.contains(e.name))
    {
      markFirstTime(e);
      documentTags.add(e.name);
    }

  return makeTag(e, isSupposed);
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:Parser.java


示例6: handleEmptyTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
@Override
protected void handleEmptyTag(TagElement tag) {
    if (parserState == ParserState.METHOD && HTML.Tag.CODE.equals(tag.getHTMLTag())) {
        if (methodWithTypes != null) {
            // process collected method data
            methods.add(methodWithTypes);
            this.methodText.put(methodWithTypes, getArgSignature());

            // clear the text builder for next method
            methodTextBuilder.delete(0, methodTextBuilder.length());
            methodWithTypes = null;
        }

        parserState = ParserState.METHOD_SUMMARY;
    } else if (parserState == ParserState.METHOD_SUMMARY
        && !methods.isEmpty()
        && HTML.Tag.TABLE.equals(tag.getHTMLTag())) {
        // end of method summary table
        parserState = ParserState.INIT;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:JavadocParser.java


示例7: handleEmptyTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
protected final void handleEmptyTag(TagElement tag)
  throws javax.swing.text.ChangedCharSetException
{
  callBack.handleSimpleTag(tag.getHTMLTag(), getAttributes(),
                           hTag.where.startPosition
                          );
}
 
开发者ID:vilie,项目名称:javify,代码行数:8,代码来源:GnuParserDelegator.java


示例8: handleStartTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
protected final void handleStartTag(TagElement tag)
{
  SimpleAttributeSet attributes = gnu.getAttributes();

  if (tag.fictional())
    attributes.addAttribute(ParserCallback.IMPLIED, Boolean.TRUE);

  callBack.handleStartTag(tag.getHTMLTag(), attributes,
                          hTag.where.startPosition
                         );
}
 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:GnuParserDelegator.java


示例9: _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


示例10: startingTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
/**
 * This should fire additional actions in response to the
 * ChangedCharSetException.  The current implementation
 * does nothing.
 * @param tag
 */
private void startingTag(TagElement tag)
{
  try
    {
      startTag(tag);
    }
  catch (ChangedCharSetException cax)
    {
      error("Invalid change of charset");
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:Parser.java


示例11: handleEmptyTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
/**
 * Handle the tag with no content.
 * @param tag the tag to handle.
 */
protected void handleEmptyTag(TagElement tag)
{
  String name = tag.getHTMLTag().toString();

  if (name.equalsIgnoreCase("#pcdata"))
    return;

  Node c = createNode(name);
  cursor.appendChild(c);
}
 
开发者ID:vilie,项目名称:javify,代码行数:15,代码来源:DomHTMLParser.java


示例12: handleEndTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
/**
 * Close the given tag. Close and reopen all nested tags.
 * @param tag the tag to close.
 */
protected void handleEndTag(TagElement tag)
{
  String name = tag.getHTMLTag().toString();
  String nname = cursor.getNodeName();

  // Closing the current tag.
  if (nname != null && nname.equalsIgnoreCase(name))
    {
      cursor = cursor.getParentNode();
    }
  else
    {
      Node nCursor = cursor.getParentNode();

      // Remember the opened nodes.
      LinkedList open = new LinkedList();
      Node close = cursor;
      while (close != null && !close.getNodeName().equalsIgnoreCase(name))
        {
          if (close != document)
            open.addFirst(close);
          close = close.getParentNode();
        }
      if (close == null)
        cursor = document;
      else
        cursor = close.getParentNode();

      // Insert the copies of the opened nodes.
      Iterator iter = open.iterator();
      while (iter.hasNext())
        {
          Node item = (Node) iter.next();
          cursor.appendChild(item);
          cursor = item;
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:43,代码来源:DomHTMLParser.java


示例13: 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


示例14: handleEndTag

import javax.swing.text.html.parser.TagElement; //导入依赖的package包/类
/**
 * Close the given tag. Close and reopen all nested tags.
 * @param tag the tag to close.
 */
protected void handleEndTag(TagElement tag)
{
  String name = tag.getHTMLTag().toString();
  String nname = cursor.getNodeName();

  // Closing the current tag.
  if (nname != null && nname.equalsIgnoreCase(name))
    {
      cursor = cursor.getParentNode();
    }
  else
    {
      Node nCursor = cursor.getParentNode();

      // Remember the opened nodes.
      LinkedList open = new LinkedList();
      Node close = cursor;
      while (close != null && !close.getNodeName().equalsIgnoreCase(name))
        {
          if (close != document)
            open.addFirst(close);
          close = close.getParentNode();
        }
      if (close == null)
        cursor = document;
      else
        cursor = close.getParentNode();

      // Insert the copies of the opened nodes.   
      Iterator iter = open.iterator();
      while (iter.hasNext())
        {
          Node item = (Node) iter.next();
          cursor.appendChild(item);
          cursor = item;
        }
    }
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:43,代码来源:DomHTMLParser.java


示例15: 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


示例16: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PullRequest类代码示例发布时间:2022-05-23
下一篇:
Java PHLight类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap