org.htmlparser.Tag.isEndTag()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.htmlparser.Tag.isEndTag()方法的一些代码示例,展示了Tag.isEndTag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.isEndTag()方法的具体详情如下:
包路径:org.htmlparser.Tag
类名称:Tag
方法名:isEndTag

Tag.isEndTag介绍

[英]Predicate to determine if this tag is an end tag (i.e. </HTML>).
[中]谓词以确定此标记是否为结束标记(即</HTML>)。

代码示例

代码示例来源:origin: com.bbossgroups.pdp/pdp-cms

/**
 * @see org.htmlparser.Tag#isEndTag()
 */
public boolean isEndTag() {
  return m_decorated.isEndTag();
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * @see org.htmlparser.Tag#isEndTag()
 */
public boolean isEndTag() {
  return m_decorated.isEndTag();
}

代码示例来源:origin: org.opencms/opencms-solr

/**
 * @see org.htmlparser.Tag#isEndTag()
 */
public boolean isEndTag() {
  return m_decorated.isEndTag();
}

代码示例来源:origin: org.htmlparser/htmlparser

/**
   * Accept nodes that are tags and have a matching tag name.
   * This discards non-tag nodes and end tags.
   * The end tags are available on the enclosing non-end tag.
   * @param node The node to check.
   * @return <code>true</code> if the tag name matches,
   * <code>false</code> otherwise.
   */
  public boolean accept (Node node)
  {
    return ((node instanceof Tag)
        && !((Tag)node).isEndTag ()
        && ((Tag)node).getTagName ().equals (mName));
  }
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
   * Accept nodes that are tags and have a matching tag name.
   * This discards non-tag nodes and end tags.
   * The end tags are available on the enclosing non-end tag.
   * @param node The node to check.
   * @return <code>true</code> if the tag name matches,
   * <code>false</code> otherwise.
   */
  public boolean accept (Node node)
  {
    return ((node instanceof Tag)
        && !((Tag)node).isEndTag ()
        && ((Tag)node).getTagName ().equals (mName));
  }
}

代码示例来源:origin: com.bbossgroups.pdp/pdp-cms

if(!tag.isResource())
  if(tag.isEndTag() && 
      (tag.getParent() != null 
      && tag.getParent().isResource()))

代码示例来源:origin: omegat-org/omegat

result.append('<');
int n = -1;
if (tag.isEndTag()) {
  result.append('/');
    Tag othertag = sTags.get(i);
    if (othertag.getTagName().equals(tag.getTagName())) {
      if (othertag.isEndTag()) {
        recursion++;
      } else {

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

if (tag.isEndTag ())
  ends = current.getEndTagEnders ();
else

代码示例来源:origin: org.htmlparser/htmlparser

if (tag.isEndTag ())
  ends = current.getEndTagEnders ();
else

代码示例来源:origin: org.htmlparser/htmlparser

if (!tag.isEndTag ())

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

if (!tag.isEndTag ())

代码示例来源:origin: org.opencms/org.opencms.workplace.tools.content

if (tag.isEndTag()) {
  replacementName = "/" + replacementName;

代码示例来源:origin: org.htmlparser/htmlparser

/**
   * Accept tags with parent acceptable to the filter.
   * If recursion is enabled, each parent in turn up to
   * the topmost enclosing node is checked.
   * Recursion only proceeds while no parent satisfies the
   * filter.
   * @param node The node to check.
   * @return <code>true</code> if the node has an acceptable parent,
   * <code>false</code> otherwise.
   */
  public boolean accept (Node node)
  {
    Node parent;
    boolean ret;

    ret = false;
    if (!(node instanceof Tag) || !((Tag)node).isEndTag ())
    {
      parent = node.getParent ();
      if ((null != parent) && (null != getParentFilter ()))
      {
        ret = getParentFilter ().accept (parent);
        if (!ret && getRecursive ())
          ret = accept (parent);
      }
    }

    return (ret);
  }
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
   * Accept tags with parent acceptable to the filter.
   * If recursion is enabled, each parent in turn up to
   * the topmost enclosing node is checked.
   * Recursion only proceeds while no parent satisfies the
   * filter.
   * @param node The node to check.
   * @return <code>true</code> if the node has an acceptable parent,
   * <code>false</code> otherwise.
   */
  public boolean accept (Node node)
  {
    Node parent;
    boolean ret;

    ret = false;
    if (!(node instanceof Tag) || !((Tag)node).isEndTag ())
    {
      parent = node.getParent ();
      if ((null != parent) && (null != getParentFilter ()))
      {
        ret = getParentFilter ().accept (parent);
        if (!ret && getRecursive ())
          ret = accept (parent);
      }
    }

    return (ret);
  }
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

node = lexer.nextNode (false);
if (null != node)
  if (!(node instanceof Tag) || !(   ((Tag)node).isEndTag ()
    && ((Tag)node).getTagName ().equals (tagname)))

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

if (!(node instanceof Tag) || !((Tag)node).isEndTag ())

代码示例来源:origin: org.htmlparser/htmlparser

if (!(node instanceof Tag) || !((Tag)node).isEndTag ())

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

node = lexer.nextNode (false);
if (null != node)
  if (!(node instanceof Tag) || !(   ((Tag)node).isEndTag ()
    && ((Tag)node).getTagName ().equals (tag.getIds ()[0])))

代码示例来源:origin: org.htmlparser/htmlparser

node = lexer.nextNode (false);
if (null != node)
  if (!(node instanceof Tag) || !(   ((Tag)node).isEndTag ()
    && ((Tag)node).getTagName ().equals (tag.getIds ()[0])))

代码示例来源:origin: iipc/openwayback

/**
 * test expected behavior of htmlparser.
 * <p>htmlparser does neither unescape HTML entities found in text, nor
 * escape special characters in Node.toHtml().  We have a workaround based on this
 * behavior.  If this expectation breaks, we need to modify our code.</p>
 * @throws Exception
 */
public void testHtmlParser_attributeValueEscaping() throws Exception {
  final String html = "<html>" +
      "<body>" +
      "<a href=\"http://example.com/api?a=1&amp;b=2&c=3&#34;\">anchor</a>" +
      "</body>" +
      "</html>";
  byte[] bytes = html.getBytes();
  ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
  Page page = new Page(bais, "UTF-8");
  Lexer lexer = new Lexer(page);
  Node node;
  while ((node = lexer.nextNode()) != null) {
    if (node instanceof Tag) {
      Tag tag = (Tag)node;
      if (tag.getTagName().equalsIgnoreCase("A") && !tag.isEndTag()) {
        assertEquals("href", "http://example.com/api?a=1&amp;b=2&c=3&#34;", tag.getAttribute("HREF"));
        String htmlout = tag.toHtml();
        assertEquals("toHtml output", "<a href=\"http://example.com/api?a=1&amp;b=2&c=3&#34;\">", htmlout);
      }
    }
  }
}

相关文章