public static void main(String... args) throws IOException { Document document = Jsoup.parse("<div>" + "<a href=\"#\"> I don't want this text </a>" + "**I want to retrieve this text**" + "</div>"); Element a = document.select("a").first(); Node node = a.nextSibling(); System.out.println(node.toString()); }
private void addNotifyImpl() { // add itself to reflect to changes children of original node nodeL = new ChildrenAdapter(this); original.addNodeListener(nodeL); filterSupport().update(); }
public Node[] callGetNodes(boolean optimalResult) { Node[] hold = null; if (optimalResult) { hold = original.getChildren().getNodes(true); } hold = Children.this.getNodes(); return hold; }
/** Convenience method to create new sheet set named {@link #PROPERTIES}. * * @return a new properties sheet set */ public static Sheet.Set createPropertiesSet() { Sheet.Set ps = new Sheet.Set(); ps.setName(PROPERTIES); ps.setDisplayName(Node.getString("Properties")); ps.setShortDescription(Node.getString("HINT_Properties")); return ps; }
@Override public String getDisplayName() { if (delegating(DELEGATE_GET_DISPLAY_NAME)) { return original.getDisplayName(); } else { return super.getDisplayName(); } }
@Override public void setDisplayName(String s) { if (delegating(DELEGATE_SET_DISPLAY_NAME)) { original.setDisplayName(s); } else { super.setDisplayName(s); } }
/** Called on first use. */ @Override final void callAddNotify() { entrySupport().setEntries(createEntries(getMap()), true); super.callAddNotify(); }
private synchronized void setSheetImpl(Sheet s) { if (sheetCookieL == null) { sheetCookieL = new SheetAndCookieListener(); } if (sheet != null) { sheet.removePropertyChangeListener(sheetCookieL); } s.addPropertyChangeListener(sheetCookieL); sheet = s; }
@Override public void destroy() throws java.io.IOException { if (delegating(DELEGATE_DESTROY)) { original.destroy(); } else { super.destroy(); } }
/** Fires a change event for {@link #PROP_COOKIE}. * The old and new values are set to null. */ protected final void fireCookieChange() { Lookup l = findDelegatingLookup(); if (l instanceof NodeLookup) { ((NodeLookup) l).updateLookupAsCookiesAreChanged(null); } fireOwnPropertyChange(PROP_COOKIE, null, null); }
public void useNodes(Collection<Node> nodes) { // forces creation of the array ChildrenArray arr = getArray(null); arr.useNodes(this, nodes); // assign all there nodes the new children for (Node n : nodes) { n.assignTo(EntrySupportDefault.this.children, -1); n.fireParentNodeChange(null, children.parent); } }
/** Allows subclasses that directly modifies the * map with nodes to synchronize the state of the children. * This method should be called under * MUTEX.writeAccess. * * @param key the key that should be refreshed */ final void refreshKeyImpl(T key) { entrySupport().refreshEntry(new ME(key, null)); }
/** Can be overridden in subclasses (probably in FilterNode) to check * whether children are of the right subclass */ void updateChildren() { Children ch = hierarchy; if (ch instanceof Children.LazyChildren) { // Replace the children with the ones provided lazily: ch = ((Children.LazyChildren) ch).getOriginal(); setChildren(ch); } }
/** Get the number of nodes in the list. * @return the count */ public final int getNodesCount() { checkSupport(); return entrySupport().getNodesCount(false); }
/** @return either nodes associated with this children or null if * they are not created */ private Node[] testNodes() { return getEntrySupport() == null ? null : entrySupport().testNodes(); }
/** Method that can be used to test whether the children content has * ever been used or it is still not initalized. * @return true if children has been used before * @see #addNotify */ protected final boolean isInitialized() { return entrySupport().isInitialized(); }
@Override public int getNodesCount(boolean optimalResult) { node.switchToOriginal(); return super.getNodesCount(optimalResult); }
public Node[] callGetNodes(boolean optimalResult) { Node[] hold = null; if (optimalResult) { hold = original.getChildren().getNodes(true); } hold = Children.this.getNodes(); return hold; }