org.jsoup.nodes.Element.after()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(241)

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

Element.after介绍

[英]Insert the specified HTML into the DOM after this element (as a following sibling).
[中]将指定的HTML插入到此元素之后的DOM中(作为以下同级)。

代码示例

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

/**
 * Insert the supplied HTML after each matched element's outer HTML.
 * @param html HTML to insert after each element
 * @return this, for chaining
 * @see Element#after(String)
 */
public Elements after(String html) {
  for (Element element : this) {
    element.after(html);
  }
  return this;
}

代码示例来源:origin: rmpestano/cukedoctor

private void addFooterStyle(Element contentElement) {
  String styleClass = " <style>  \n" + "\n" + "#content:padding:0!important;\n" + ".sidebarblock, .sectionbody, .content{\n" + "overflow:auto!important;\n" + "}\ndiv.sidebarblock {overflow-y:hidden;overflow-x:auto}\n body .exampleblock > .content{ background:#fff}";
  contentElement.after(styleClass);
}

代码示例来源:origin: com.github.cukedoctor/cukedoctor-extension

private void addFooterStyle(Element contentElement) {
  String styleClass = " <style>  \n" + "\n" + "#content:padding:0!important;\n" + ".sidebarblock, .sectionbody, .content{\n" + "overflow:auto!important;\n" + "}\ndiv.sidebarblock {overflow-y:hidden;overflow-x:auto}\n body .exampleblock > .content{ background:#fff}";
  contentElement.after(styleClass);
}

代码示例来源:origin: astamuse/asta4d

public Element after(Node node) {
  return originElement.after(node);
}

代码示例来源:origin: astamuse/asta4d

public Element after(String html) {
  return originElement.after(html);
}

代码示例来源:origin: com.github.cukedoctor/cukedoctor-extension

"</script>      ";
contentElement.after(themeScript);

代码示例来源:origin: rmpestano/cukedoctor

"</script>      ";
contentElement.after(themeScript);

代码示例来源:origin: imalexyang/ExamStack

private static String exampaper_formater(String content){
    Document doc = Jsoup.parse(content,"UTF-8");
    
    Elements lis= doc.select("li");
    Elements textareas = doc.select("textarea");
    Elements inputs = doc.select("input");
    
    for(Element e:lis){
      e.after("<br/>");
    }
    
    for(Element e:inputs){
      String tmp_text = e.text();
      e.after("<p>" + tmp_text + "</p>");
      e.remove();
    }
    
    for(Element e:textareas){
      e.after("<br /><br /><br /><br /><br />");
      e.remove();
    }
    
    return doc.toString();
  }
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  String xml = "<measure><note/><note at='1'/></measure>";
  Document parse = Jsoup.parse(xml, "", Parser.xmlParser());

  for (Element thismeasure : parse.getElementsByTag("measure")) {

    for (Element thisnote : thismeasure.children()) {
      if (thisnote.attr("at").equals("1")){
        thisnote.text("newText");
        thisnote.attr("newAttr", "value");
        thisnote.before(new Element(Tag.valueOf("test1"),""));
        thisnote.after(new Element(Tag.valueOf("test2"),""));
      }
    }
  }

  System.out.println(parse);
}

代码示例来源:origin: rmpestano/cukedoctor

private void addMinMaxScript(Element contentElement) {
  String minMaxScript = HIDE_FEATURES_SECTION ? getMinMaxScriptForDocWithoutFeaturesSection() : "<script type=\"text/javascript\">\n" +
      "\tfunction showFeatureScenarios(featureId){\n" +
      "\t\tvar element = document.getElementById(featureId).parentNode;\n" +
      "\t\tfor (var i = 0; i < element.childNodes.length; i++) {\n" +
      "    \t\tif (element.childNodes[i].className == \"sect3\" || element.childNodes[i].className == \"fa fa-minus-square fa-fw\") {\n" +
      "      \t\t     element.childNodes[i].style.display = 'inline';\n" +
      "    \t\t\t}\n" +
      "    \t\tif (element.childNodes[i].className == \"sidebarblock\") {\n" +
      "      \t\t     element.childNodes[i].style.display = 'block';\n" +
      "    \t\t\t}\t\t\t        \n" +
      "\t\t}\n" +
      "\t\t \n" +
      " \t\tdocument.getElementById(featureId).children[0].click();\n" +
      "\t}\n" +
      "\n" +
      "\tfunction hideFeatureScenarios(featureId){\n" +
      "\t\tvar element = document.getElementById(featureId).parentNode;\n" +
      "\t\tfor (var i = 0; i < element.childNodes.length; i++) {\n" +
      "    \t\tif (element.childNodes[i].className == \"sect3\" || element.childNodes[i].className == \"sidebarblock\") { \n" +
      "      \t\t     element.childNodes[i].style.display = 'none';\t   \t\t    \n" +
      "                 \t}\n" +
      "\t\t      \n" +
      "\t\t}\n" +
      "\t   document.getElementById(featureId).children[0].click();\n" +
      " \t}\n" +
      "\n" +
      "</script>";
  contentElement.after(minMaxScript);
}

代码示例来源:origin: com.github.cukedoctor/cukedoctor-extension

private void addMinMaxScript(Element contentElement) {
  String minMaxScript = HIDE_FEATURES_SECTION ? getMinMaxScriptForDocWithoutFeaturesSection() : "<script type=\"text/javascript\">\n" +
      "\tfunction showFeatureScenarios(featureId){\n" +
      "\t\tvar element = document.getElementById(featureId).parentNode;\n" +
      "\t\tfor (var i = 0; i < element.childNodes.length; i++) {\n" +
      "    \t\tif (element.childNodes[i].className == \"sect3\" || element.childNodes[i].className == \"fa fa-minus-square fa-fw\") {\n" +
      "      \t\t     element.childNodes[i].style.display = 'inline';\n" +
      "    \t\t\t}\n" +
      "    \t\tif (element.childNodes[i].className == \"sidebarblock\") {\n" +
      "      \t\t     element.childNodes[i].style.display = 'block';\n" +
      "    \t\t\t}\t\t\t        \n" +
      "\t\t}\n" +
      "\t\t \n" +
      " \t\tdocument.getElementById(featureId).children[0].click();\n" +
      "\t}\n" +
      "\n" +
      "\tfunction hideFeatureScenarios(featureId){\n" +
      "\t\tvar element = document.getElementById(featureId).parentNode;\n" +
      "\t\tfor (var i = 0; i < element.childNodes.length; i++) {\n" +
      "    \t\tif (element.childNodes[i].className == \"sect3\" || element.childNodes[i].className == \"sidebarblock\") { \n" +
      "      \t\t     element.childNodes[i].style.display = 'none';\t   \t\t    \n" +
      "                 \t}\n" +
      "\t\t      \n" +
      "\t\t}\n" +
      "\t   document.getElementById(featureId).children[0].click();\n" +
      " \t}\n" +
      "\n" +
      "</script>";
  contentElement.after(minMaxScript);
}

代码示例来源:origin: com.github.cukedoctor/cukedoctor-extension

.replaceAll("sect2", "sect1").replaceAll("H3", "H2");
contentElement.after(searchScripts);

代码示例来源:origin: rmpestano/cukedoctor

.replaceAll("sect2", "sect1").replaceAll("H3", "H2");
contentElement.after(searchScripts);

代码示例来源:origin: com.atlassian.confluence.ext/newcode-macro-plugin

private String addExpandCollapseHtml(String content) {
  final Document doc = Jsoup.parse(content);
  final Elements headerElements = doc.select("div.codeHeader");
  if (headerElements != null && StringUtils.isNotEmpty(headerElements.toString())) {
    final Element headerElement = headerElements.get(0);
    headerElement.addClass("hide-border-bottom");
    headerElement.child(0).addClass("code-title");
    headerElement.child(0).after(addCollapseSourceHtml());
    final Element contentElement = doc.select("div.codeContent").get(0);
    contentElement.addClass("hide-toolbar");
  } else {
    final Element contentElement = doc.select("div.codeContent").get(0);
    contentElement.before(addHeaderHtml());
    contentElement.addClass("hide-toolbar");
  }
  return doc.body().html();
}

代码示例来源:origin: Infosys/openIDP

tableLast.after(table);

代码示例来源:origin: theonedev/onedev

referencedPath = GitUtils.normalizePath(referencedPath);
if (referencedPath != null && TreeWalk.forPath(repository, referencedPath, commit.getTree()) == null) {
    element.after("<span class='missing'>!!missing!!</span>");
    Element missingElement = element.nextElementSibling();
    BlobIdent blobIdent = blobRenderContext.getBlobIdent();
          "<a href='%s' title='Add this file' class='add-missing'><i class='fa fa-plus'></i></a>", 
          urlToAddFile.toString());
      missingElement.after(htmlToAddFile);
referencedPath = GitUtils.normalizePath(referencedPath);
if (referencedPath != null && TreeWalk.forPath(repository, referencedPath, commit.getTree()) == null) {
  element.after("<span class='missing'>!!missing!!</span>");

代码示例来源:origin: astamuse/asta4d

element.after(fakedSnippetNode);
element.remove();
fakedSnippetNode.appendChild(element);

代码示例来源:origin: org.eclipse.mylyn.docs/org.eclipse.mylyn.wikitext

computeAfterTarget(element).after(textNode);
  computeAfterTarget(element).after(textNode);
  computeAfterTarget(element).after(textNode);

代码示例来源:origin: org.eclipse.mylyn.docs/org.eclipse.mylyn.wikitext

} else if (childNodes.get(childNodes.size() - 1) == element) {
  element.remove();
  parent.after(element);
  modifiedOne = true;

代码示例来源:origin: perfectsense/brightspot-cms

paragraph.after(lastParagraph);

相关文章

Element类方法