org.jsoup.parser.Tag.isEmpty()方法的使用及代码示例

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

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

Tag.isEmpty介绍

[英]Get if this is an empty tag
[中]如果这是一个空标签

代码示例

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

/**
 * Gets if this tag is a data only tag.
 *
 * @return if this tag is a data only tag
 */
public boolean isData() {
  return !canContainInline && !isEmpty();
}

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

void outerHtmlHead(final Appendable accum, int depth, final Document.OutputSettings out) throws IOException {
  if (out.prettyPrint() && (tag.formatAsBlock() || (parent() != null && parent().tag().formatAsBlock()) || out.outline())) {
    if (accum instanceof StringBuilder) {
      if (((StringBuilder) accum).length() > 0)
        indent(accum, depth, out);
    } else {
      indent(accum, depth, out);
    }
  }
  accum.append('<').append(tagName());
  if (attributes != null) attributes.html(accum, out);
  // selfclosing includes unknown tags, isEmpty defines tags that are always empty
  if (childNodes.isEmpty() && tag.isSelfClosing()) {
    if (out.syntax() == Document.OutputSettings.Syntax.html && tag.isEmpty())
      accum.append('>');
    else
      accum.append(" />"); // <img> in html, <img /> in xml
  }
  else
    accum.append('>');
}

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

Element insertEmpty(Token.StartTag startTag) {
  Tag tag = Tag.valueOf(startTag.name(), settings);
  Element el = new Element(tag, baseUri, startTag.attributes);
  insertNode(el);
  if (startTag.isSelfClosing()) {
    if (tag.isKnownTag()) {
      if (!tag.isEmpty())
        tokeniser.error("Tag cannot be self closing; not a void tag");
    }
    else // unknown tag, remember this is self closing for output
      tag.setSelfClosing();
  }
  return el;
}

代码示例来源:origin: dhanji/sitebricks

if (element.childNodes().isEmpty() && element.tag().isEmpty()) {
  accum.append(" />");
} else {

代码示例来源:origin: com.google.sitebricks/sitebricks

if (element.childNodes().isEmpty() && element.tag().isEmpty()) {
  accum.append(" />");
} else {

代码示例来源:origin: br.com.objectos/sitebricks

if (element.childNodes().isEmpty() && element.tag().isEmpty()) {
  accum.append(" />");
} else {

代码示例来源:origin: br.com.objectos/sitebricks

return false;
if (parent.isEmpty() || parent.isData())
 return false;

代码示例来源:origin: com.google.sitebricks/sitebricks

return false;
if (parent.isEmpty() || parent.isData())
 return false;

代码示例来源:origin: dhanji/sitebricks

return false;
if (parent.isEmpty() || parent.isData())
 return false;

代码示例来源:origin: com.google.sitebricks/sitebricks

boolean isEmptyElement = tag.isEmpty(); // empty element if empty tag (e.g. img) or self-closed el (<div/>
if (tq.matchChomp("/>")) { // close empty element or tag
 isEmptyElement = true;

代码示例来源:origin: br.com.objectos/sitebricks

boolean isEmptyElement = tag.isEmpty(); // empty element if empty tag (e.g. img) or self-closed el (<div/>
if (tq.matchChomp("/>")) { // close empty element or tag
 isEmptyElement = true;

代码示例来源:origin: dhanji/sitebricks

boolean isEmptyElement = tag.isEmpty(); // empty element if empty tag (e.g. img) or self-closed el (<div/>
if (tq.matchChomp("/>")) { // close empty element or tag
 isEmptyElement = true;

相关文章