List of usage examples for org.jsoup.nodes Element ownerDocument
public Document ownerDocument()
From source file:com.astamuse.asta4d.render.RenderUtil.java
private final static void applySnippetResultToElement(Document doc, String snippetRefId, Element snippetElement, Element renderTarget, Renderer renderer) { apply(renderTarget, renderer);/* w ww . j a v a 2 s . c o m*/ 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); } }
From source file:org.structr.web.importer.Importer.java
private String nodeToString(Node node) { if (node instanceof TextNode) { return ((TextNode) node).getWholeText(); } else if (node instanceof Element) { final Element el = (Element) node; final boolean prettyPrintBackup = el.ownerDocument().outputSettings().prettyPrint(); el.ownerDocument().outputSettings().prettyPrint(false); final String result = el.outerHtml(); el.ownerDocument().outputSettings().prettyPrint(prettyPrintBackup); return result; } else {//w w w . j a v a 2 s. com return node.toString(); } }