Java HTML Jsoup Element getTextFromNodeIfAvailable(Element doc)

Here you can find the source of getTextFromNodeIfAvailable(Element doc)

Description

get Text From Node If Available

License

Open Source License

Declaration

public static String getTextFromNodeIfAvailable(Element doc) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;

public class Main {
    public static String getTextFromNodeIfAvailable(Element doc) {
        StringBuffer result = new StringBuffer();
        for (Node child : doc.childNodes()) {
            if (child instanceof TextNode) {
                result.append(((TextNode) child).text());
            }//from w w w  .  j  a  va 2 s .co  m
        }
        return result.toString();
    }
}

Related

  1. getSrcOrRelFromImageElement(Element imgElm)
  2. getString(Elements td, int i)
  3. getTextContent(Element node)
  4. getTextFromAClass(Element doc, String location)
  5. getTextFromMultipleSelect(Element doc, String location, String locationValue)
  6. getTextFromNodeSelect(Element doc, String location, String locationValue)
  7. getTitle(Element el, String[] titles)
  8. getUserId(Element authorElement)
  9. isChildOf(Element child, Elements possibleParents)