本文整理了Java中org.jsoup.nodes.Element.prepend()
方法的一些代码示例,展示了Element.prepend()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.prepend()
方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:prepend
[英]Add inner HTML into this element. The supplied HTML will be parsed, and each node prepended to the start of the element's children.
[中]将内部HTML添加到此元素中。将解析提供的HTML,并将每个节点前置到元素子元素的开头。
代码示例来源:origin: org.jsoup/jsoup
/**
* Add the supplied HTML to the start of each matched element's inner HTML.
* @param html HTML to add inside each element, before the existing HTML
* @return this, for chaining
* @see Element#prepend(String)
*/
public Elements prepend(String html) {
for (Element element : this) {
element.prepend(html);
}
return this;
}
代码示例来源:origin: apache/nifi
break;
case PREPEND_ELEMENT:
ele.prepend(putValue);
break;
代码示例来源:origin: rakam-io/rakam
parse.head().prepend(String.format("<base href='%s'>", url));
parse.head().prepend("<link href=\"/static/components/codemirror/lib/codemirror.css\" media=\"screen\" rel=\"stylesheet\" />");
parse.head().prepend("<link href=\"/static/embed/jquery-ui-theme.css\" media=\"screen\" rel=\"stylesheet\" />");
parse.head().prepend("<link href=\"/static/components/bootstrap-colorpicker/css/colorpicker.css\" media=\"screen\" rel=\"stylesheet\" />");
parse.head().prepend("<link href=\"/static/embed/rakam-inline-editor.css\" media=\"screen\" rel=\"stylesheet\" />");
parse.head().prepend("<script src=\"/static/embed/rakam-inline-editor.js\"></script>");
parse.head().prepend("<script src=\"/static/components/bootstrap-colorpicker/js/bootstrap-colorpicker.js\"></script>");
parse.head().prepend("<script src=\"/static/components/codemirror/mode/xml/xml.js\"></script>");
parse.head().prepend("<script src=\"/static/components/codemirror/mode/javascript/javascript.js\"></script>");
parse.head().prepend("<script src=\"/static/components/codemirror/mode/css/css.js\"></script>");
parse.head().prepend("<script src=\"/static/components/codemirror/mode/vbscript/vbscript.js\"></script>");
parse.head().prepend("<script src=\"/static/components/codemirror/mode/htmlmixed/htmlmixed.js\"></script>");
parse.head().prepend("<script src=\"/static/components/codemirror/lib/codemirror.js\"></script>");
parse.head().prepend("<script src=\"/static/components/jquery-ui/jquery-ui.min.js\"></script>");
parse.head().prepend("<script src=\"/static/components/jquery/dist/jquery.min.js\"></script>");
代码示例来源:origin: org.jboss.errai/errai-bus
final Document document = Jsoup.parse(responseWrapper.toString());
String injectedScript = "<script>var " + ERRAI_CSRF_TOKEN_VAR + " = '" + CSRFTokenCheck.getToken(session) + "';</script>";
document.head().prepend(injectedScript);
output = document.html();
代码示例来源:origin: com.wandrell.velocity/maven-site-fixer
/**
* Fixes the dependencies report page.
*
* @param root
* root element for the report page to fix
*/
private final void fixReportDependencies(final Element root) {
root.prepend("<h1>Dependencies Report</h1>");
}
代码示例来源:origin: com.wandrell.velocity/maven-site-fixer
/**
* Fixes the License report page.
*
* @param root
* root element for the report page to fix
*/
private final void fixReportLicense(final Element root) {
root.prepend("<h1>License</h1>");
}
代码示例来源:origin: com.wandrell.velocity/maven-site-fixer
/**
* Fixes the plugins report page.
*
* @param root
* root element for the report page to fix
*/
private final void fixReportPlugins(final Element root) {
root.prepend("<h1>Plugins Report</h1>");
}
代码示例来源:origin: astamuse/asta4d
public Element prepend(String html) {
return originElement.prepend(html);
}
代码示例来源:origin: USPTO/PatentPublicData
@Override
public String getPlainText(String rawText, FreetextConfig textConfig) {
Document jsoupDoc = Jsoup.parse(rawText, "", Parser.xmlParser());
for (Element paragraph : jsoupDoc.select("PARA")) {
int level = paragraph.attr("LVL") != null ? Integer.valueOf(paragraph.attr("LVL")) : 0;
StringBuilder stb = new StringBuilder();
for (int i = 0; i <= level; i++) {
stb.append(" ");
}
paragraph.prepend(stb.toString());
}
String simpleHtml = getSimpleHtml(jsoupDoc.outerHtml());
Document simpleDoc = Jsoup.parse(simpleHtml, "", Parser.xmlParser());
HtmlToPlainText htmlConvert = new HtmlToPlainText(textConfig);
return htmlConvert.getPlainText(simpleDoc);
}
代码示例来源:origin: USPTO/PatentPublicData
@Override
public String getPlainText(String rawText, FreetextConfig textConfig) {
Document jsoupDoc = Jsoup.parse(rawText, "", Parser.xmlParser());
for (int j = 0; j < 4; j++) {
for (Element paragraph : jsoupDoc.select("PA" + j)) {
int level = j;
StringBuilder stb = new StringBuilder();
for (int i = 0; i <= level; i++) {
stb.append(" ");
}
paragraph.prepend(stb.toString());
}
}
String simpleHtml = getSimpleHtml(jsoupDoc.outerHtml());
Document simpleDoc = Jsoup.parse(simpleHtml, "", Parser.xmlParser());
HtmlToPlainText htmlConvert = new HtmlToPlainText(textConfig);
return htmlConvert.getPlainText(simpleDoc);
}
代码示例来源:origin: errai/errai
final Document document = Jsoup.parse(responseWrapper.toString());
String injectedScript = "<script>var " + ERRAI_CSRF_TOKEN_VAR + " = '" + CSRFTokenCheck.getToken(session) + "';</script>";
document.head().prepend(injectedScript);
output = document.html();
代码示例来源:origin: com.sdl.dxa/dxa-tridion-provider
/**
* <p>processProperty.</p>
*
* @param propertyElement a {@link org.jsoup.nodes.Element} object.
*/
protected static void processProperty(Element propertyElement) {
String xpath = propertyElement.attr("data-entity-property-xpath");
HtmlNode xpmMarkup = new HtmlCommentNode(String.format(FIELD_PATTERN, xpath));
if (propertyElement.childNodes().size() > 0) {
if (!propertyXpmMarkupAlreadyGenerated(propertyElement)) {
propertyElement.prepend(xpmMarkup.toHtml());
}
} else {
propertyElement.before(xpmMarkup.toHtml());
}
propertyElement.removeAttr("data-entity-property-xpath");
}
代码示例来源:origin: com.sdl.dxa/dxa-tridion-provider
Element html = entityMarkup.getHtmlElement();
if (html != null) { // If an HTML element (not a comment etc)
html.prepend(buildXpmMarkup(entity, webRequestContext.getLocalization()).toHtml());
Elements properties = html.select("[data-entity-property-xpath]");
for (Element property : properties) {
代码示例来源:origin: com.sdl.dxa/dxa-tridion-provider
Element html = regionMarkup.getHtmlElement();
if (html != null && !RegionXpmMarkup.isFirstNodeXpmEntityXPMMarkup(html)) {
html.prepend(buildXpmMarkup(region, webRequestContext.getLocalization()).toHtml());
markupInjected = true;
内容来源于网络,如有侵权,请联系作者删除!