private void getPreformattedText(DomNode node, StringBuffer toReturn) { if (node.isDisplayed()) { toReturn.append(node.getTextContent()); } }
/** * Gets the textContent attribute. * @return the contents of this node as text */ public String jsxGet_textContent() { return this.<DomNode>getDomNodeOrDie().getTextContent(); }
StringBuffer sb = new StringBuffer(/*some appropriate size*/); for (DomNode n : element.getChildNodes()) { if (n.getNodeType() == Node.TEXT_NODE) { sb.append(n.getTextContent()); } } String text = sb.toString();
/** * Gets the textContent attribute. * @return the contents of this node as text */ @JsxGetter public String getTextContent() { return getDomNodeOrDie().getTextContent(); }
/** * Returns the text content of the node or the concatenated text representing the node and its descendants. * @return the text content of the node and its descendants */ @JsxGetter public Object getText() { final DomNode domNode = getDomNodeOrDie(); return domNode.getTextContent(); }
/** * Gets the textContent attribute. * @return the contents of this node as text */ @JsxGetter public String getTextContent() { return getDomNodeOrDie().getTextContent(); }
/** * Returns the text content of the node or the concatenated text representing the node and its descendants. * @return the text content of the node and its descendants */ @JsxGetter public Object getText() { final DomNode domNode = getDomNodeOrDie(); return domNode.getTextContent(); }
@Override public String get(final ComputedCSSStyleDeclaration style) { final String value = style.getStyleAttribute(WIDTH, true); if (StringUtils.isEmpty(value)) { if ("absolute".equals(getStyleAttribute(POSITION, true))) { final String content = getDomNodeOrDie().getTextContent(); // do this only for small content // at least for empty div's this is more correct if (null != content && content.length() < 13) { return (content.length() * 7) + "px"; } } int windowDefaultValue = getWindowDefaultValue(); if (elem instanceof HTMLBodyElement) { windowDefaultValue -= 16; } return windowDefaultValue + "px"; } else if (AUTO.equals(value)) { int windowDefaultValue = getWindowDefaultValue(); if (elem instanceof HTMLBodyElement) { windowDefaultValue -= 16; } return windowDefaultValue + "px"; } return value; } });
/** * {@inheritDoc} */ @Override public String getTextContent() { switch (getNodeType()) { case ELEMENT_NODE: case ATTRIBUTE_NODE: case ENTITY_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: final StringBuilder builder = new StringBuilder(); for (final DomNode child : getChildren()) { final short childType = child.getNodeType(); if (childType != COMMENT_NODE && childType != PROCESSING_INSTRUCTION_NODE) { builder.append(child.getTextContent()); } } return builder.toString(); case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: case PROCESSING_INSTRUCTION_NODE: return getNodeValue(); default: return null; } }
/** * {@inheritDoc} */ public String getTextContent() { switch (getNodeType()) { case ELEMENT_NODE: case ATTRIBUTE_NODE: case ENTITY_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: final StringBuilder builder = new StringBuilder(); for (final DomNode child : getChildren()) { final short childType = child.getNodeType(); if (childType != COMMENT_NODE && childType != PROCESSING_INSTRUCTION_NODE) { builder.append(child.getTextContent()); } } return builder.toString(); case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: case PROCESSING_INSTRUCTION_NODE: return getNodeValue(); default: return null; } }
/** * {@inheritDoc} */ public String getTextContent() { switch (getNodeType()) { case ELEMENT_NODE: case ATTRIBUTE_NODE: case ENTITY_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: final StringBuilder builder = new StringBuilder(); for (final DomNode child : getChildren()) { final short childType = child.getNodeType(); if (childType != COMMENT_NODE && childType != PROCESSING_INSTRUCTION_NODE) { builder.append(child.getTextContent()); } } return builder.toString(); case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: case PROCESSING_INSTRUCTION_NODE: return getNodeValue(); default: return null; } }
@Override public String get(final ComputedCSSStyleDeclaration style) { final String value = style.getStyleAttribute(WIDTH, true); if (StringUtils.isEmpty(value)) { if (ABSOLUTE.equals(getStyleAttribute(POSITION, true))) { final String content = getDomNodeOrDie().getTextContent(); // do this only for small content // at least for empty div's this is more correct if (null != content && content.length() < 13) { return (content.length() * 7) + "px"; } } int windowDefaultValue = getWindowDefaultValue(); if (elem instanceof HTMLBodyElement) { windowDefaultValue -= 16; } return windowDefaultValue + "px"; } else if (AUTO.equals(value)) { int windowDefaultValue = getWindowDefaultValue(); if (elem instanceof HTMLBodyElement) { windowDefaultValue -= 16; } return windowDefaultValue + "px"; } return value; } });
/** * {@inheritDoc} */ public String getTextContent() { switch (getNodeType()) { case ELEMENT_NODE: case ATTRIBUTE_NODE: case ENTITY_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: final StringBuilder builder = new StringBuilder(); for (final DomNode child : getChildren()) { final short childType = child.getNodeType(); if (childType != COMMENT_NODE && childType != PROCESSING_INSTRUCTION_NODE) { builder.append(child.getTextContent()); } } return builder.toString(); case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: case PROCESSING_INSTRUCTION_NODE: return getNodeValue(); default: return null; } }
/** * {@inheritDoc} */ @Override public String getTextContent() { switch (getNodeType()) { case ELEMENT_NODE: case ATTRIBUTE_NODE: case ENTITY_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: final StringBuilder builder = new StringBuilder(); for (final DomNode child : getChildren()) { final short childType = child.getNodeType(); if (childType != COMMENT_NODE && childType != PROCESSING_INSTRUCTION_NODE) { builder.append(child.getTextContent()); } } return builder.toString(); case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: case PROCESSING_INSTRUCTION_NODE: return getNodeValue(); default: return null; } }
dataBuilder.append(toRemove.getTextContent()); if (removeChildTextNodes || firstText != null) { toRemove.remove();
dataBuilder.append(toRemove.getTextContent()); if (ie || firstText != null) { toRemove.remove();
dataBuilder.append(toRemove.getTextContent()); if (ie || firstText != null) { toRemove.remove();
dataBuilder.append(toRemove.getTextContent()); if (ie || firstText != null) { toRemove.remove();
private void Login() throws FailingHttpStatusCodeException, MalformedURLException, IOException { WebClient client = new WebClient(); client.setJavaScriptEnabled(false); HtmlPage page = client.getPage("http://svergja.com/forum/"); HtmlForm form = (HtmlForm) page.getElementById("navbar_loginform"); HtmlTextInput username = (HtmlTextInput) page.getElementById("navbar_username"); username.setValueAttribute("stackoverflow"); HtmlPasswordInput password = (HtmlPasswordInput) page.getElementById("navbar_password"); password.setValueAttribute("stackit123"); HtmlSubmitInput button = form.getInputByValue("Log in"); page = button.click(); List<HtmlAnchor> anchorList = page.getAnchors(); for (HtmlAnchor htmlAnchor : anchorList) { if(htmlAnchor.getAttribute("href").contains("member.php?")) { page = htmlAnchor.click(); } } HtmlSpan span = (HtmlSpan) page.getElementById("userinfo"); DomNodeList<DomNode> nodeList = span.getChildNodes(); for (DomNode domNode : nodeList) { NamedNodeMap map = domNode.getAttributes(); Node node = map.getNamedItem("class"); if(node != null && node.getNodeValue() != null && node.getNodeValue().equals("usertitle")) { System.out.println("The usergroup is "+domNode.getTextContent()); } } }
final ComputedCSSStyleDeclaration style = e.getWindow().getComputedStyle(e, null); final int height = getBrowserVersion().getFontHeight(style.getFontSize()); width += child.getTextContent().length() * (int) (height / 1.8f); width += child.getTextContent().length() * getBrowserVersion().getPixesPerChar();