本文整理了Java中org.jsoup.nodes.Element.clone()
方法的一些代码示例,展示了Element.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.clone()
方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:clone
暂无
代码示例来源:origin: org.jsoup/jsoup
@Override
public Document clone() {
Document clone = (Document) super.clone();
clone.outputSettings = this.outputSettings.clone();
return clone;
}
代码示例来源:origin: jphp-group/jphp
@Override
public WrapElement __clone(Environment environment, TraceInfo traceInfo) {
return new WrapElement(environment, __wrappedObject.clone());
}
代码示例来源:origin: org.jsoup/jsoup
/**
* Creates a deep copy of these elements.
* @return a deep copy
*/
@Override
public Elements clone() {
Elements clone = new Elements(size());
for(Element e : this)
clone.add(e.clone());
return clone;
}
代码示例来源:origin: code4craft/webmagic
/**
* Only document can be select
* See: https://github.com/code4craft/webmagic/issues/113
*
* @param elementIterator elementIterator
* @return element element
*/
private Element checkElementAndConvert(ListIterator<Element> elementIterator) {
Element element = elementIterator.next();
if (!(element instanceof Document)) {
Document root = new Document(element.ownerDocument().baseUri());
Element clone = element.clone();
root.appendChild(clone);
elementIterator.set(root);
return root;
}
return element;
}
代码示例来源:origin: astamuse/asta4d
@Override
protected Element transform(Element elem, Element content) {
return content.clone();
}
代码示例来源:origin: astamuse/asta4d
public Element clone() {
return originElement.clone();
}
代码示例来源:origin: astamuse/asta4d
public Element toElement() {
return renderedElement.clone();
}
代码示例来源:origin: astamuse/asta4d
@Override
public Element transform(Element elem, ElementSetter content) {
Element result = elem.clone();
content.set(result);
return result;
}
代码示例来源:origin: astamuse/asta4d
@Override
protected Element transform(Element elem, Object content) {
String logStr = logMessage + "( " + creationSiteInfo + " ):\n" + elem.toString();
logger.debug(logStr);
// we have to clone a new element, which is how transformer works.
Element newElem = elem.clone();
return newElem;
}
代码示例来源:origin: jungilhan/awesome-blogs-android
/**
* Replaces all {@code <br/>} tags with a newline in a copy of the input node, and
* returns the resulting innter text.
* This is necessary to ensure that manual linebreaks are supported in preformatted code.
*
* @param oinput Preformatted node to process
* @return inner text of the node.
*/
private String getPreformattedText(Element oinput) {
Element el = oinput.clone();
fixLineBreaks(el);
return el.text();
}
代码示例来源:origin: astamuse/asta4d
@Override
protected Element transform(Element elem, Renderer content) {
Element result = elem.clone();
// add a dummy parent so that the result element can be replaced by the
// sub renderer.
GroupNode wrapper = new GroupNode();
wrapper.appendChild(result);
RenderUtil.apply(result, content);
return wrapper;
}
代码示例来源:origin: us.codecraft/webmagic-core
/**
* Only document can be select
* See: https://github.com/code4craft/webmagic/issues/113
*
* @param elementIterator elementIterator
* @return element element
*/
private Element checkElementAndConvert(ListIterator<Element> elementIterator) {
Element element = elementIterator.next();
if (!(element instanceof Document)) {
Document root = new Document(element.ownerDocument().baseUri());
Element clone = element.clone();
root.appendChild(clone);
elementIterator.set(root);
return root;
}
return element;
}
代码示例来源:origin: com.cv4j.netdiscovery/netdiscovery-core
/**
* Only document can be select
* See: https://github.com/code4craft/webmagic/issues/113
*
* @param elementIterator elementIterator
* @return element element
*/
private Element checkElementAndConvert(ListIterator<Element> elementIterator) {
Element element = elementIterator.next();
if (!(element instanceof Document)) {
Document root = new Document(element.ownerDocument().baseUri());
Element clone = element.clone();
root.appendChild(clone);
elementIterator.set(root);
return root;
}
return element;
}
代码示例来源:origin: lt.velykis.maven.skins/reflow-velocity-tools
element.replaceWith(replacementElem.clone());
代码示例来源:origin: andriusvelykis/reflow-maven-skin
element.replaceWith(replacementElem.clone());
代码示例来源:origin: com.wandrell.velocity/maven-site-fixer
element.replaceWith(replacementElem.clone());
代码示例来源:origin: USPTO/PatentPublicData
public void fixFigrefListItem(Element element) {
Node next = element.nextSibling();
String trailingTxt;
if (next != null && next instanceof TextNode) {
trailingTxt = ((TextNode) next).getWholeText();
} else if (next != null && next instanceof Element) {
trailingTxt = ((Element) next).text();
} else {
return;
}
if (trailingTxt.matches("^(, |,? and )")) {
next = element.nextSibling().nextSibling();
if (next.nodeName().toLowerCase().equals("b")) {
String containedTxt = ((TextNode) next.childNode(0)).getWholeText();
if (containedTxt.matches("[0-9]{1,2}[A-z]?")) {
Element newEl = element.clone();
newEl.attr("id", "FR-" + Strings.padStart(containedTxt, 4, '0'));
newEl.attr("idref", ReferenceTagger.createFigId(containedTxt));
newEl.tagName("a");
newEl.addClass("figref");
newEl.text(containedTxt);
next.replaceWith(newEl);
fixFigrefListItem(newEl);
}
}
}
}
代码示例来源:origin: kriegaex/Galileo-Openbook-Cleaner
return;
Element indexLink = findFirstElement(Selector.TOC_HEADING_2).clone();
String fileExtension = ".htm";
Node ankerNode = null;
代码示例来源:origin: Kaysoro/KaellyBot
private static Almanax gatheringOnlineData(Language lg, String date) throws IOException {
LOG.info("connecting to " + Translator.getLabel(lg, "almanax.url") + date + " ...");
Document doc = JSoupManager.getDocument(Translator.getLabel(lg, "almanax.url") + date);
String bonus = doc.getElementsByClass("more").first()
.clone().getElementsByClass("more-infos").empty().parents().first().text();
String quest = doc.getElementsByClass("more-infos").first().child(0).text();
String ressourceURL = doc.getElementsByClass("more-infos-content").first().children().attr("src");
String offrande = doc.getElementsByClass("fleft").get(3).text();
return new Almanax(bonus, offrande, date, quest, ressourceURL);
}
内容来源于网络,如有侵权,请联系作者删除!