本文整理了Java中org.jsoup.nodes.Element.ownerDocument()
方法的一些代码示例,展示了Element.ownerDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.ownerDocument()
方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:ownerDocument
暂无
代码示例来源: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: org.jsoup/jsoup
if (context.ownerDocument() != null) // quirks setup:
doc.quirksMode(context.ownerDocument().quirksMode());
代码示例来源:origin: astamuse/asta4d
public Document ownerDocument() {
return originElement.ownerDocument();
}
代码示例来源:origin: us.codecraft/xsoup
@Override
public Document getOwnerDocument() {
return new DocumentAdaptor(element.ownerDocument());
}
代码示例来源:origin: code4craft/xsoup
@Override
public Document getOwnerDocument() {
return NodeAdaptors.getDocument(element.ownerDocument());
}
代码示例来源:origin: code4craft/xsoup
@Override
public Document getOwnerDocument() {
return new DocumentAdaptor(element.ownerDocument());
}
代码示例来源:origin: us.codecraft/xsoup
@Override
public Document getOwnerDocument() {
return NodeAdaptors.getDocument(element.ownerDocument());
}
代码示例来源:origin: astamuse/asta4d
private final static void applySnippetResultToElement(Document doc, String snippetRefId, Element snippetElement, Element renderTarget,
Renderer renderer) {
apply(renderTarget, renderer);
if (snippetElement.ownerDocument() == null) {
// it means this snippet element is replaced by a
// element completely
String reSelector = SelectorUtil.attr(ExtNodeConstants.SNIPPET_NODE_TAG_SELECTOR, ExtNodeConstants.ATTR_SNIPPET_REF,
snippetRefId);
Elements elems = doc.select(reSelector);
if (elems.size() > 0) {
snippetElement = elems.get(0);
} else {
snippetElement = null;
}
}
if (snippetElement != null) {
snippetElement.attr(ExtNodeConstants.SNIPPET_NODE_ATTR_STATUS, ExtNodeConstants.SNIPPET_NODE_ATTR_STATUS_FINISHED);
}
}
代码示例来源:origin: org.aperteworkflow/webapi
private void createButton(Element parent, String actionButtonId, String buttonClass, String iconClass,
String messageKey, String descriptionKey, String clickFunction) {
Element buttonNode = parent.ownerDocument().createElement("button")
.attr("class", buttonClass != null ? "btn btn-" + buttonClass : "btn")
.attr("disabled", "true")
.attr("id", actionButtonId)
.attr("data-toggle", "tooltip")
.attr("data-placement", "bottom")
.attr("title", i18Source.getMessage(descriptionKey));
Element buttonIcon = parent.ownerDocument().createElement("span")
.attr("class", iconClass != null ? "glyphicon glyphicon-" + iconClass : "glyphicon");
parent.appendChild(buttonNode);
buttonNode.appendChild(buttonIcon);
buttonNode.appendText(i18Source.getMessage(messageKey));
scriptBuilder.append("$('#").append(actionButtonId).append("').click(function() { ").append(clickFunction).append("('").append(getViewedObjectId()).append("'); });");
scriptBuilder.append("$('#").append(actionButtonId).append("').tooltip();");
}
代码示例来源:origin: astamuse/asta4d
public final static void removeNodesBySelector(Element target, String selector, boolean pullupChildren) {
Elements removeNodes = target.select(selector);
Iterator<Element> it = removeNodes.iterator();
Element rm;
while (it.hasNext()) {
rm = it.next();
if (target == rm) {
continue;
}
if (rm.ownerDocument() == null) {
continue;
}
if (pullupChildren) {
pullupChildren(rm);
}
rm.remove();
}
}
代码示例来源:origin: org.aperteworkflow/webapi
private void addClaimActionButton(Element parent) {
String actionButtonId = "action-button-claim";
Element buttonNode = parent.ownerDocument().createElement("button")
.attr("class", "btn btn-warning")
.attr("disabled", "true")
.attr("id", actionButtonId);
parent.appendChild(buttonNode);
Element cancelButtonIcon = parent.ownerDocument().createElement("span")
.attr("class", "glyphicon glyphicon-download");
parent.appendChild(buttonNode);
buttonNode.appendChild(cancelButtonIcon);
buttonNode.appendText(i18Source.getMessage("button.claim"));
Long processStateConfigurationId = task.getCurrentProcessStateConfiguration().getId();
scriptBuilder.append("$('#").append(actionButtonId)
.append("').click(function() { claimTaskFromQueue('#action-button-claim','null', '")
.append(processStateConfigurationId).append("','")
.append(task.getInternalTaskId())
.append("'); });")
.append("$('#").append(actionButtonId)
.append("').tooltip({placement: 'bottom', title: '").append(i18Source.getMessage("button.claim.descrition")).append("'});");
}
代码示例来源: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: 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: org.aperteworkflow/webapi
Element buttonNode = parent.ownerDocument().createElement("button")
.attr("class", btnClass)
.attr("disabled", "true")
Element actionButtonIcon = parent.ownerDocument().createElement("span")
.attr("class", "glyphicon glyphicon-" + iconName);
代码示例来源:origin: basis-technology-corp/Java-readability
if (ee.ownerDocument() == null) {
continue; // it a child of something we've already killed, so it
代码示例来源:origin: org.apache.sling/org.apache.sling.hapi.client
private ItemImpl follow(Element el, MicrodataDocument doc) throws ClientException {
if (el.hasAttr("itemscope")) {
return new ItemImpl(el, doc);
}
if (el.tagName().equalsIgnoreCase("a") && el.hasAttr("href")) {
String href = el.attr("href");
if (href.startsWith("#")) {
Element first = el.ownerDocument().select(href).first();
return first == null ? null : follow(first, doc);
}
String absHref = el.attr("abs:href");
MicrodataDocument d = (MicrodataDocument) doc.client.get(absHref);
try {
URI uri = new URI(absHref);
String fragment = uri.getRawFragment();
if (fragment != null) {
Element e = d.jsoupDocument.getElementById(fragment);
return e == null ? null : follow(e, d);
}
} catch (URISyntaxException ex) {
throw new ClientException("Error parsing URI: " + absHref, ex);
}
ItemsImpl items = (ItemsImpl) d.items();
if (items.length() == 1) {
return (ItemImpl) items.at(0);
}
throw new ClientException("Unable determine item: " + absHref);
}
return new ItemImpl(el, doc);
}
代码示例来源:origin: org.aperteworkflow/webapi
Element divContentNode = parent.ownerDocument().createElement("div")
.attr("id", "vertical_layout" + widget.getId());
parent.appendChild(divContentNode);
Element ulNode = parent.ownerDocument().createElement("ul")
.attr("id", tabId)
.attr("class", "nav nav-tabs");
parent.appendChild(ulNode);
Element divContentNode = parent.ownerDocument().createElement("div")
.attr("id", divContentId)
.attr("class", "tab-content");
Element liNode = parent.ownerDocument().createElement("li");
ulNode.appendChild(liNode);
Element aNode = parent.ownerDocument().createElement("a")
.attr("id", "tab_link_" + childId)
.attr("href", '#' + childId)
Element divTabContentNode = parent.ownerDocument().createElement("div")
.attr("id", childId)
.attr("class", isFirst ? "tab-pane active" : "tab-pane");
Element divContentNode = parent.ownerDocument().createElement("div")
.attr("id", "vertical_layout" + widget.getId());
parent.appendChild(divContentNode);
Element divContentNode = parent.ownerDocument().createElement("div")
代码示例来源:origin: astamuse/asta4d
if (context.ownerDocument() != null) // quirks setup:
doc.quirksMode(context.ownerDocument().quirksMode());
代码示例来源:origin: jungilhan/awesome-blogs-android
/**
* Handle an ignored HTMLElement.
* The default method here is to either write the HTMLElement as a block if it is a block element,
* or write it directly if it is not.
*
* @param node Node to handle
* @param converter Parent converter for this object.
*/
public void handleIgnoredHTMLElement(Element node, DocumentConverter converter) {
if(node.isBlock()) {
converter.output.writeBlock(node.toString());
} else {
// Note: because this is an inline element, we want to make sure it stays that way!
// this means turning off prettyPrinting, so that JSoup doesn't add unecessary spacing around
// the child nodes.
Document doc = node.ownerDocument();
boolean oldPrettyPrint = doc.outputSettings().prettyPrint();
doc.outputSettings().prettyPrint(false);
converter.output.write(node.toString());
doc.outputSettings().prettyPrint(oldPrettyPrint);
}
}
代码示例来源:origin: perfectsense/brightspot-cms
Element paragraph = body.ownerDocument().createElement(tag.getName());
内容来源于网络,如有侵权,请联系作者删除!