本文整理了Java中org.jsoup.nodes.Element.append()
方法的一些代码示例,展示了Element.append()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.append()
方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:append
[英]Add inner HTML to this element. The supplied HTML will be parsed, and each node appended to the end of the children.
[中]将内部HTML添加到此元素。将解析提供的HTML,并将每个节点附加到子节点的末尾。
代码示例来源:origin: org.jsoup/jsoup
/**
* Add the supplied HTML to the end of each matched element's inner HTML.
* @param html HTML to add inside each element, after the existing HTML
* @return this, for chaining
* @see Element#append(String)
*/
public Elements append(String html) {
for (Element element : this) {
element.append(html);
}
return this;
}
代码示例来源:origin: com.vaadin/vaadin-server
private void writeRow(Element container, T item, DesignContext context) {
Element tableRow = container.appendElement("tr");
tableRow.attr("item", serializeDeclarativeRepresentation(item));
if (getSelectionModel().isSelected(item)) {
tableRow.attr("selected", true);
}
for (Column<T, ?> column : getColumns()) {
Object value = column.valueProvider.apply(item);
tableRow.appendElement("td")
.append(Optional.ofNullable(value).map(Object::toString)
.map(DesignFormatter::encodeForTextNode)
.orElse(""));
}
}
代码示例来源:origin: com.vaadin/vaadin-server
break;
case HTML:
cellElement.append(Optional.ofNullable(state.html).orElse(""));
break;
case WIDGET:
代码示例来源:origin: com.vaadin/vaadin-server
mainDiv.appendElement("noscript").append(
"You have to enable javascript in your browser to use an application built with Vaadin.");
fragmentNodes.add(mainDiv);
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
Element popupContent = new Element(Tag.valueOf("popup-content"), "");
popupContent.appendChild(
designContext.createElement(content.getPopupComponent()));
String minimizedHTML = content.getMinimizedValueAsHTML();
if (minimizedHTML != null && !minimizedHTML.isEmpty()) {
design.append(minimizedHTML);
}
design.appendChild(popupContent);
}
代码示例来源:origin: com.vaadin/vaadin-server
item.getStyleName(), def.getStyleName(), String.class, context);
menuElement.append(item.getText());
代码示例来源:origin: org.jsoup/jsoup
/**
* Set this element's inner HTML. Clears the existing HTML first.
* @param html HTML to parse and set into this element
* @return this element
* @see #append(String)
*/
public Element html(String html) {
empty();
append(html);
return this;
}
代码示例来源:origin: com.vaadin/vaadin-server
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
String altText = getAltText();
if (altText != null && !altText.isEmpty()) {
design.append(altText);
}
for (Resource r : getSources()) {
Attributes attr = design.appendElement("source").attributes();
DesignAttributeHandler.writeAttribute("href", attr, r, null,
Resource.class, designContext);
}
}
代码示例来源:origin: apache/nifi
switch (context.getProperty(PUT_LOCATION_TYPE).getValue()) {
case APPEND_ELEMENT:
ele.append(putValue);
break;
case PREPEND_ELEMENT:
代码示例来源:origin: com.vaadin/vaadin-server
private void writeRow(Element container, T item, T parent,
DesignContext context) {
Element tableRow = container.appendElement("tr");
tableRow.attr("item", serializeDeclarativeRepresentation(item));
if (parent != null) {
tableRow.attr("parent", serializeDeclarativeRepresentation(parent));
}
if (getSelectionModel().isSelected(item)) {
tableRow.attr("selected", true);
}
for (Column<T, ?> column : getColumns()) {
Object value = column.getValueProvider().apply(item);
tableRow.appendElement("td")
.append(Optional.ofNullable(value).map(Object::toString)
.map(DesignFormatter::encodeForTextNode)
.orElse(""));
}
getDataProvider().fetch(new HierarchicalQuery<>(null, item)).forEach(
childItem -> writeRow(container, childItem, item, context));
}
代码示例来源:origin: stackoverflow.com
Document document = Jsoup.connect(url).get();
Element head = document.head();
head.append("<link rel=\"stylesheet\" href=\"http://example.com/your.css\">");
代码示例来源:origin: com.vaadin/flow-server
private static void setupDocumentBody(Document document) {
document.body().appendElement("noscript").append(
"You have to enable javascript in your browser to use this web site.");
}
代码示例来源:origin: kriegaex/Galileo-Openbook-Cleaner
private void fixFontSizesForNonStandardLayout() {
headTag.append(
"<style type=\"text/css\">\n" +
"body, p, a, tr, td, td.nav1, td.nav2, .weiter a, .zurueck a, " +
".themen, .white, .merksatz, .warnung, .beispiel, .anleser { font-size: 13px; }\n" +
"h1 a, h2 a, h3 a, h4 a, h5 a { font-size: 16px; }\n" +
"pre, code { font-size: 12px; }\n" +
"</style>\n"
);
}
代码示例来源:origin: astamuse/asta4d
public Element append(String html) {
return originElement.append(html);
}
代码示例来源:origin: stackoverflow.com
Element e = d.get(20);
e.text("new text");
e.append("<a href=\"http://www.yahoo.com/\">Links?</a>");//lets you add HTML.
代码示例来源:origin: aint/laverna-android
/**
* A method which adds style in the head of the document.
* @param doc a document to add style.
*/
private void addDocStyle(Document doc) {
Element head = doc.head();
head.append(DOC_STYLE);
}
代码示例来源:origin: aint/laverna-android
/**
* A method which parses html using Jsoup,
* @param htmlText a text to parse.
* @return a document with parsed text.
*/
private Document getParsedHtmlDocument(String htmlText) {
Document doc = Jsoup.parseBodyFragment(htmlText);
doc.outputSettings(new Document.OutputSettings().prettyPrint(false));
doc.head().append(DOC_STYLE);
doc.body().append(HIGHLIGHT_JS_SCRIPT);
return doc;
}
代码示例来源:origin: kriegaex/Galileo-Openbook-Cleaner
private static void moveNodes(Elements sourceNodes, Element targetElement) {
for (Element element : sourceNodes) {
element.remove();
for (Node node : element.childNodes())
targetElement.append(node.outerHtml());
}
}
代码示例来源:origin: chimbori/crux
private static void replaceLineBreaksWithSpaces(Element topNode) {
for (Element brNextToBrElement : topNode.select("br + br")) {
brNextToBrElement.remove();
}
for (Element brElement : topNode.select("br")) {
if (brElement.previousSibling() != null) {
brElement.previousSibling().after(" • ");
} else {
brElement.parent().append(" • ");
}
brElement.unwrap();
}
}
代码示例来源:origin: asciidoctor/asciidoctorj
@Override
public String process(Document document, String output) {
String copyright = "Copyright Acme, Inc.";
if(document.isBasebackend("html")) {
org.jsoup.nodes.Document doc = Jsoup.parse(output, "UTF-8");
Element contentElement = doc.getElementById("footer-text");
contentElement.append(copyright);
output = doc.html();
}
return output;
}
内容来源于网络,如有侵权,请联系作者删除!